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

php json_encode() does not output Chinese

巴扎黑
巴扎黑Original
2016-11-11 13:23:511617browse

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编码。

Php code

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


Statement:
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