$username = 'abc张红军';
preg_match_all("/[\x80-\xff]?./", $username, $r);$s = array();
foreach($r[0] as $v) {
if(ord($v) < 0x80)
$s[] = ord($v);
else
$s[] = '\\u'.bin2hex(iconv('GBK', 'UCS-2', $v));
}
echo join(',', $s);
out
97,98,99,\u5f20,\u7ea2,\u519b
preg_match_all("/[\x80-\xff]?./", $username, $r);$s = array();
foreach($r[0] as $v) {
if(ord($v) < 0x80)
$s[] = ord($v);
else
$s[] = '\\u'.bin2hex(iconv('GBK', 'UCS-2', $v));
}
echo join(',', $s);
out
97,98,99,\u5f20,\u7ea2,\u519b
如果把中文转成10进制的unicode值呢?(不是用\u开头),
是不是直接把 5f20算出来啊? 5f20是十六进制吗?多谢了!!
希望老大们多给建议
-------------------------------
It should be.