php Method to convert unicode encoding to Chinese characters: First create a PHP sample file; then use the "function unicodeDecode($unicode_str){...}" method to convert unicode characters into Chinese.
#The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.
unicode decoding method, convert unicode characters into Chinese, the code is as follows:
function unicodeDecode($unicode_str){ $json = '{"str":"'.$unicode_str.'"}'; $arr = json_decode($json,true); if(empty($arr)) return ''; return $arr['str']; } $unicode_str = "\u65b0\u6d6a\u5fae\u535a"; echo unicodeDecode($unicode_str);
Unicode decoding result: "Sina Weibo"
[Recommended study: "PHP video tutorial》】
The above is the detailed content of How to convert php unicode encoding to Chinese characters. For more information, please follow other related articles on the PHP Chinese website!