一、 解决办法
$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
数据二、解决办法二
$filter = $this->request->get('filter', '',['htmlspecialchars_decode']);
发表评论 取消回复