php_公共方法01_传入数组_打印可见信息

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

 

你可能感兴趣的:(PHP)