//将Unicode编码的中文转换成utf8编码的中文
function decodeUnicode($str){
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', create_function('$matches', 'return iconv("UCS-2BE","UTF-8",pack("H*", $matches[1]));'), $str);
}
$json = '{\"error\":\"\",\"title\":\"\u52A0\u539A\u6D17\u8F66\u6BDB\u5DFE\u8F66\u7528\u5438\u6C34\u64E6\u8F66\u5E03\"}';
$json = decodeUnicode($json);
$json = stripslashes($json);
$json = json_decode($json,true);
print_r($json);
将Unicode编码的中文转换成utf8编码的中文
最新推荐文章于 2024-04-10 10:43:38 发布