Home > Backend Development > PHP Tutorial > php json_encode() does not output Chinese

php json_encode() does not output Chinese

巴扎黑
Release: 2016-11-11 13:23:51
Original
1635 people have browsed it

php json_encode() does not output Chinese, but characters such as "u4e2du6587" appear.

Php code

<?php  
echo json_encode("中文");  
   
//"\u4e2d\u6587"  
 如何让它变成中文呢?就要使用JSON_UNESCAPED_UNICODE,让JSON不要输出Unicode编码。
Copy after login

Php code

<?php  
echo json_encode("中文", JSON_UNESCAPED_UNICODE);  
   
//"中文"
Copy after login


Related labels:
php
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template