postman的操作:
thinkphp5框架的input()方法会对特殊字符串进行转义,如:[ ], { } 等,这里也是坑了我很长时间。
解决办法如下:
其他方法:
1.使用 htmlspecialchars_decode()
htmlspecialchars() 转义
["a","b","c"]
htmlspecialchars_decode($a) 反转义
["a","b","c"]
2.使用 stripslashes()
$content = $_POST['content'];
$content = stripslashes($content);
$array = json_decode($content, true);
参考网址:
https://blog.csdn.net/lorraine_40t/article/details/91441816
https://blog.csdn.net/u012427462/article/details/41653041
https://blog.csdn.net/u013032345/article/details/82745417