["/Public/editor/php/../attached/image/20150115/20150115094109_33178.jpg","/Public/editor/php/../attached/image/20150115/20150115094110_19764.jpg"]
表单提交上面字符串,
php接收并输出,结果是[\"/Public/editor/php/../attached/image/20150115/20150115094109_33178.jpg\",\"/Public/editor/php/../attached/image/20150115/20150115094110_19764.jpg\"]
百度了一下,使用stripslashes把反斜杠去掉后使用json_decode()转化,结果为空。
$img=stripslashes($data['img']);
$img_list=json_decode($img);
$test='["/Public/editor/php/../attached/image/20150115/20150115094109_33178.jpg","/Public/editor/php/../attached/image/20150115/20150115094110_19764.jpg"]';
//$test内容为输入框里的字符串
if($test == $img) echo 1; //if语句不成立,没有输出1;
是什么情况啊。。。
["/Public/editor/php/../attached/image/20150115/20150115094109_33178.jpg","/Public/editor/php/../attached/image/20150115/20150115094110_19764.jpg"]
表单提交上面字符串,
php接收并输出,结果是[\"/Public/editor/php/../attached/image/20150115/20150115094109_33178.jpg\",\"/Public/editor/php/../attached/image/20150115/20150115094110_19764.jpg\"]
百度了一下,使用stripslashes把反斜杠去掉后使用json_decode()转化,结果为空。
$img=stripslashes($data['img']);
$img_list=json_decode($img);
$test='["/Public/editor/php/../attached/image/20150115/20150115094109_33178.jpg","/Public/editor/php/../attached/image/20150115/20150115094110_19764.jpg"]';
//$test内容为输入框里的字符串
if($test == $img) echo 1; //if语句不成立,没有输出1;
是什么情况啊。。。
楼主可以了解一下array_diff
stripslashes后var_dump看下,是否是合法的json字串。 是不是有实体的双引号 ?
谢谢@star001007 提醒,其实那个引号不需要过滤,json字符串本来就是需要用""引起来的。提主直接json_decode就可以了
已抢140970个
抢已抢4614个
抢已抢7250个
抢已抢20339个
抢