JSON_UNESCAPED_UNICODE
private function decodeUnicode($str){
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
create_function(
'$matches',
'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'
),
$str);
}
JSON_UNESCAPED_UNICODE
private function decodeUnicode($str){
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
create_function(
'$matches',
'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'
),
$str);
}
转载于:https://www.cnblogs.com/Clymene/p/10063074.html