Home > Backend Development > PHP Tutorial > json里的编码后的中文如何还原

json里的编码后的中文如何还原

WBOY
Release: 2016-06-13 13:40:17
Original
1096 people have browsed it

json里的编码后的中文怎么还原
像这个“\u6d59\u6c5f\u7701\u676d”怎么还原回中文

------解决方案--------------------
json_decode
------解决方案--------------------
linux
$str=preg_replace("#\\\u([0-9a-f]{4})#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $str);

windows
$str=preg_replace("#\\\u([0-9a-f]{4})#ie", "iconv('UCS-2LE', 'UTF-8', pack('H4', '\\1'))", $str);

浙江省杭

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template