小编Mih*_*lan的帖子

PHP 相当于 javascript JSON.stringify()

正如我注意到 PHP 的json_encode($array)弄乱了变音符号。\n如果我使用通过 HTTP 传递的 javascript 创建的 JSON更新我的数据库列类型文本,一切看起来都很好。但是当我将JSON创建到PHP中时,某些字符的编码方式很奇怪。

\n

我有这个数组;

\n
$array = ['M-am \xc3\xaent\xc3\xaelnit ieri cu','fosta mea prof\xc4\x83 de matematic\xc4\x83'];\n\n$text = implode(",",$array); // this looks good in db\n$json = json_encode($array); // this don't and returns error when try to decode later.\n
Run Code Online (Sandbox Code Playgroud)\n

javascript php json equivalent

3
推荐指数
1
解决办法
3085
查看次数

标签 统计

equivalent ×1

javascript ×1

json ×1

php ×1