- When we use
json_encode
time, you will find this situation
json_encode("tian jia cheng gong")
Words written in English will not be converted to Unicode;
<?php
echo json_encode("tian jia cheng gong ");
//"tian jia cheng gong "
but
json_encode("添加成功")
Words written in Chinese will be converted to Unicode;
<?php
echo json_encode("添加成功");
//"\u6dfb\u52a0\u6210\u529f"
Sometimes I just don’t want to convert Chinese to Unicode, here is a way:
that is JSON_UNESCAPED_UNICODE
, it means that Json does not encode Unicode
<?php
echo json_encode("添加成功", JSON_UNESCAPED_UNICODE);
//"添加成功"
Tip: To learn more about json_encode, please click the link below
---> link