Home > Article > Web Front-end > Teach you how to use PHP to output Chinese JSON string_json
json_encode — JSON encodes a variable and returns the JSON form of value, for example:
Output after executing the above code:
If the data source to be encoded (usually an array) contains Chinese in the value, the output after json_encode processing is unicode encoding.
Output after executing the above code:
The bottom layer of PHP has already done unicode processing. If you think it is not intuitive enough, you can use the urlencode and urldecode methods to bypass the process of transcoding to unicode:
Output after executing the above code: