During writing and API interfaces today, PHP arrays are converted to json, but there is a rule that unicode encoding cannot be used. during writing and API operations today, PHP arrays are converted to json, however, there is a rule that unicode encoding is not supported.
I tried several methods:
If PHP is more than 5.4, you can directly use the JSON_UNESCAPED_UNICODE parameter.
Json_encode ('Chinese test', JSON_UNESCAPED_UNICODE );
This method is feasible for strings, but the array is not feasible (to be verified)
2. urlencode the string in the array, convert the json_encode of the array to json, and then perform urldecode.
Note: urlencode () and urldecode () convert Chinese characters to hexadecimal notation and combine strings according to certain rules to implement character encoding and decoding, ensure character integrity and compatibility during URL data transmission
The preceding section details the unicode encoding of Chinese characters when PHP outputs json data. For more information, see other related articles in the first PHP community!