$data =input('post.');//用户唯一标识$goods = $data['goods']; $shopcuxiao=$data['shopcuxiao']; $goods=htmlspecialchars_decode($goods); $goodslist=html_entity_decode($goods); $goodslist= json_decode($goodslist,true);
接收到的$goods是被转义成
[{"img":"upload/pinpai/img/20180930/60f3860ffe198c67e745b873dd884bbd.jpg","shopPrice":"22","goodsName":"22","ptnum":null},{"img":"upload/pinpai/img/20180930/be60908972d5cc964dfb2acc7a25cf73.jpg","shopPrice":"11","goodsName":"11","ptnum":null}]
可以用函数htmlspecialchars_decode和html_entity_decode进行转义,这样可以得到正确的json数据