Home  >  Article  >  Backend Development  >  json_encode()函数为啥不能解析带中文的JSON字符串呢

json_encode()函数为啥不能解析带中文的JSON字符串呢

WBOY
WBOYOriginal
2016-06-13 12:44:011005browse

json_encode()函数为什么不能解析带中文的JSON字符串呢?
这样就有值:

<br />
$a = '{ "a":"www", "b":2}';<br />
$arr = json_decode($a, true);<br />


这样就返回NULL:
<br />
$a = '{ "a":"你好", "b":2}';<br />
$arr = json_decode($a, true);<br />


为什么出现这种情况呢?该怎么解析带中文的JSON字符串呢?

Statement:
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