小编在网上看到最多的就是汉字转换unicode编码了,今天我们看到一个反过来的操作就是把unicode转换成中文了,下面一起来看看
这两天帮别人开发微信平台好友板块,存储用户爱好的内容都是unicode,取出来后需要转化成汉字
网上查了些方法,比较复杂,也不是特别好用,在这推荐一种方法:
function unicode_decode($name){
$json = '{"str":"'.$name.'"}';
$arr = json_decode($json,true);
if(empty($arr)) return '';
return $arr['str'];
}
把unicode编码当成一个字符串,然后将字符串保存在json里,并赋值给数组arr,输出arr的值就可以转成汉字。
$aihao = unicode_decode("\u7f8e\u98df");
echo $aihao;
输入结果为:音乐
如果大家想知道汉字转换成Unicode编码PHP程序可参考http://www.111cn.net/phper/php-cy/44986.htm

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver CS6
Visual web development tools
