unicode 格式 转汉字

mac2022-06-30  58

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);}

$arr = array('name1':"中文",'name2':'abc12');$jsonstr = decodeUnicode(json_encode($arr));

转载于:https://www.cnblogs.com/phpxj/p/11455950.html

相关资源:中文转unicode,相互转换utf8
最新回复(0)