How to convert php array to json and display Chinese

藏色散人
Release: 2023-03-06 19:54:01
Original
3130 people have browsed it

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.

How to convert php array to json and display Chinese

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!