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

 

posted @ 2015-05-20 21:17  cphmvp  阅读(171)  评论(0编辑  收藏  举报
爬虫在线测试小工具: http://tool.haoshuju.cn/