Copy codeThe Code is as follows:
<? Php
Echo json_encode ("Chinese"); // "\ u4e2d \ u6587"
This makes it a headache for those of us who develop in tianchao. Sometimes they have to write json_encode on their own.
In PHP5.4, this problem was finally solved. Json added a new option: JSON_UNESCAPED_UNICODE, so the name is Unicode, that is, Json does not encode Unicode.
See the following example:
Copy codeThe Code is as follows:
<? Php
Echo json_encode ("Chinese", JSON_UNESCAPED_UNICODE); // "Chinese"
How are changes that make everyone happy? Well, of course, Json is added in 5.4: JSON_BIGINT_AS_STRING, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, etc. If you are interested, refer to: json_encode.
However, we still need to remind you that PHP 5.4 is still in the development stage. Before the final release, any new features may be adjusted or changed. if you have any suggestions, please feel free to give us feedback and help us make PHP better.
From: http://www.laruence.com