Theme after a long time
The result shows that there is a problem with the local build.
Why don't we bother? (? ^ ?)?
When posting in Baidu POST Bar
JSON is often used to obtain some values.
So how does PHP output JSON data?
In fact, the 'json _ encoding' function already exists in PHP.
| The code is as follows: |
Copy code |
<? Php $ Array = array ( 'Newest _ Ver '=> 'None ', 'Api _ list' => 'http: // www.111cn.net /', 'Announcement '=> 'None' ); $ Result = json_encode ($ array ); Echo $ result; ?>
|
If you directly use json_encode to convert the Chinese character to NULL, this problem does not exist after urlencode.
Json data is garbled
Only UTF-8 can be used to generate a json string. However, you can use the following function to implement utf8 array transcoding and then directly use json_encode ():
| The code is as follows: |
Copy code |
Function output ($ arr = array () {return eval ('Return '. iconv ('gb2312', 'utf-8', var_export ($ arr, true )). ';');} |