时间:2021-07-01 10:21:17 帮助过:2人阅读
define('_SP_', chr(0xFF).chr(0xFE));
define('UCS2', 'ucs-2be');
//载入副词典
$hw = '';
$ds = file($dicAddon);//17行的txt格式字典文件
foreach($ds as $d)
{
$d = trim($d);
if($d=='') continue;
$estr = substr($d, 1, 1);
if( $estr==':' ) {
$hw = substr($d, 0, 1);
}
else
{
$spstr = _SP_;
$spstr = iconv(UCS2, 'utf-8', $spstr);//怎么会出现ucs2编码?咋回事
$ws = explode(',', $d);//每一行的汉字,用中间的逗号分成数组
$wall = iconv('utf-8', UCS2, join($spstr, $ws));//用_SP_又组合成了字符串??,然后又转换成了ucs2?
$ws = explode(_SP_, $wall);//又接着分割成数组?啥意思啊!!!
foreach($ws as $estr)
{
$this->addonDic[$hw][$estr] = strlen($estr);
}
}
}
define('_SP_', chr(0xFF).chr(0xFE));得到 efbfbe
define('UCS2', 'ucs-2be');
$spstr = _SP_;
$spstr = iconv(UCS2, 'utf-8', $spstr);
echo bin2hex($spstr);