我创建一个 Json 文件
$json = array(
"Add"=>array(
"context" => "$context",
"date"=> "$date"
),
"Version"=>array(
"version"=>$version
)
);
And $context
是波斯语文本(所以我的 Json 需要 UTF-8 格式)。现在我用这个
echo json_encode($json,JSON_UNESCAPED_UNICODE);
查看我的 json 文件,但 Codeigniter 给出了这 2 个错误
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant JSON_UNESCAPED_UNICODE - assumed 'JSON_UNESCAPED_UNICODE'
and
A PHP Error was encountered
Severity: Warning
Message: json_encode() expects parameter 2 to be long, string given
有什么想法吗?提前致谢。
From 文档 http://php.net/manual/en/json.constants.php:
JSON_UNESCAPED_UNICODE(整数)
[...] 自 PHP 5.4.0 起可用。
您的 PHP 版本没有定义常量(定义它也没有帮助)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)