Home > Article > Backend Development > How to convert php array to json and display Chinese
How to convert php array to json and display Chinese: First create a PHP sample file; then use the "json_encode($var,JSON_UNESCAPED_UNICODE);" method to convert the array to json without garbled Chinese characters. Can.
Recommended: "PHP Video Tutorial"
php converts arrays to json without Garbled characters appear in Chinese
One of the more convenient methods is that as long as your php is 5.4 or above, you can use the following method:
json_encode($var,JSON_UNESCAPED_UNICODE);
The sentence JSON_UNESCAPED_UNICODE is the key.
The Chinese that comes out in this way will not be garbled.
The above is the detailed content of How to convert php array to json and display Chinese. For more information, please follow other related articles on the PHP Chinese website!