php json_encode 中文不转码

2020-07-30 09:19:18

1、php json_encode 中文不转码,需要满足以下两个条件

11.jpg

2、json_encode()示例代码

12.jpg

3、保存以上代码,在浏览器预览

13.jpg

4、为json_encode()填入第二个参数:JSON_UNESCAPED_UNICODE,可以实现中文不转码

14.jpg

5、再次保存代码,在浏览器查看编码后的JSON格式的字符串,中文字符正常显示

15.jpg

相关文章 大家在看