php Solution to garbled json Chinese characters: First transcode the "Content" through the "urlencode" function; then use the "json_encode" function to json encode the variable.
Recommended: "PHP Video Tutorial"
Pictured:
Solution:
Use urlencode() to transcode the Content first, and then json_encode.
urlencode() encodes URL string function.
This function facilitates encoding a string and using it in the request part of the URL, and it also facilitates passing variables to the next page.
We often use this function to encode Chinese strings in URLs to avoid errors in URL calls.
json_encode — JSON encoding of variables
The above is the detailed content of What to do if php json Chinese characters are garbled. For more information, please follow other related articles on the PHP Chinese website!