标签:
function decodeUnicode($str) { return preg_replace_callback(‘/\\\\u([0-9a-f]{4})/i‘, ‘convert‘, $str); } function convert($matches){ return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE"); } demo: $test=array(‘一个‘=>array(‘中文‘=>‘中文‘)); var_dump(decodeUnicode(json_encode($test)));
标签:
原文地址:http://www.cnblogs.com/cphmvp/p/4518226.html