php去掉 json 字符串中的转义字符 \
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json

·
php 接收 AJAX 传输的 JSON 字符串可能加入转义字符 \
转义
- 去掉单个字符串中的转义字符
$a = "f\"oo";
$a = stripslashes($a);
- 去掉数组中的所有转义字符
$a = ["f\"oo", "b\"ar"];
$a = array_map('stripslashes', $a);
- 去掉嵌套数组中的转义字符
$a = ["f\"oo", "b\"ar", ["fo\"o", "b\"ar"]];
$a = json_decode(stripslashes(json_encode($a)), true);




适用于现代 C++ 的 JSON。
最近提交(Master分支:2 个月前 )
d33ecd3f
8 天前
d19060e6
8 天前
更多推荐
所有评论(0)