function unicode_encode($str, $encoding='GBK', $prefix='&#', $postfix=';')
{
$str = iconv($encoding, 'UCS-2', $str);
$arrstr = str_split($str, 2);
$unistr = '';
for ($i = 0, $len = count($arrstr); $i < $len; $i++)
{
$dec = hexdec(bin2hex($arrstr[$i]));
$unistr .= $prefix . $dec . $postfix;
}
return $unistr;
}echo unicode_encode("二号首长2");同样的这段代码。
在linux下输出豎隙羕㈀
在windows下输出二号首长2求解。。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货