时间:2021-07-01 10:21:17 帮助过:31人阅读
javascript的
String.fromCharCode(252)
和PHP的
chr(252)得到的结果不一样咋办?
//chr() with unicode support
function uchr ($codes) {
if (is_scalar($codes)) $codes= func_get_args();
$str= '';
foreach ($codes as $code) $str.= html_entity_decode(''.$code.';',ENT_NOQUOTES,'UTF-8');
return $str;
}
echo uchr(252);//
输出和String.fromCharCode(252)相同了