gpt4 book ai didi

php - 带有 JSON 结果的 PHP 中的波斯语字符串

转载 作者:行者123 更新时间:2023-11-29 01:29:13 25 4
gpt4 key购买 nike

我想在 mysql 数据库中编写一个包含波斯字符串的 php json 网络服务。这是我的 table : enter image description here

这是我的代码: enter image description here

结果是: enter image description here

如果您看到结果,您会看到波斯字符串显示为数字和反斜杠。为什么?我尝试任何代码来调试它,但无法做到。请帮助解释为什么波斯语字符串显示不正确。

最佳答案

在json_encode中设置unescape选项即可

JSON_UNESCAPED_UNICODE (integer) Encode multibyte Unicode characters literally (default is to escape as \uXXXX). Available since PHP 5.4.0. http://php.net/manual/en/json.constants.php

json_encode(array('Cinema' => $cinemas), JSON_UNESCAPED_UNICODE );

关于php - 带有 JSON 结果的 PHP 中的波斯语字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22744976/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com