function u2c($str){ return preg_replace_callback("#\\\u([0-9a-f]{4})#i", function ($r) { return iconv('UCS-2BE', 'UTF-8', pack('H4', $r[1]));},$str); } echo u2c('\u53ea\u80fd\u4e2d\u6587\u624d\u61c2\u6211');
标签:function,return,str,u2c,汉字,unicode,php From: https://www.cnblogs.com/boye169/p/16821030.html