php转换成汉字

<?php

header('Content-type:text/html;charset=utf-8');

function getChinese($code)

{

return preg_replace_callback('/\\\\u([0-9a-f]{4})/i',

        create_function(

            '$matches',

            'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'

        ),

        $code);

}

扫描二维码关注公众号,回复: 1520788 查看本文章






$con= "\u7b7e\u540d\u9519\u8bef";

echo getChinese($con);echo "\n";


猜你喜欢

转载自blog.csdn.net/qyt0147/article/details/79742196