Pipeline & quot;] submit the above string in the form. php receives and outputs the string. The result is [& quot; Pub... ["/Public/editor/php /.. /attached/image/20150115/20150115094109 _33178.jpg ","/Public/editor/php /.. /attached/image/20150115/20150115094110 _19764.jpg "]
The string above the form submission,
Php receives and outputs The result [\ "/Public/editor/php /.. /attached/image/20150115/20150115094109 _33178.jpg \ ", \"/Public/editor/php /.. /attached/image/20150115/20150115094110 _19764.jpg \ "]
Baidu used stripslashes to remove the backslash and use json_decode () for conversion. The result is blank.
$ 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 "] '; // The content of $ test is the string if ($ test = $ img) echo 1 in the input box; // if statement is not true, no output 1;
What is the situation...
Reply content:
["/Public/editor/php/../attached/image/20150115/20150115094109 _33178.jpg", "/Public/editor/php/../attached/image/20150115/20150115094110 _19764.jpg"]
The string above the form submission,
Php receives and outputs The result [\ "/Public/editor/php /.. /attached/image/20150115/20150115094109 _33178.jpg \ ", \"/Public/editor/php /.. /attached/image/20150115/20150115094110 _19764.jpg \ "]
Baidu used stripslashes to remove the backslash and use json_decode () for conversion. The result is blank.
$ 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 "] '; // The content of $ test is the string if ($ test = $ img) echo 1 in the input box; // if statement is not true, no output 1;
What is the situation...
For more information, seearray_diff
After stripslashes var_dump, check whether it is a legal json string. Is there a double quotation mark for the entity?
Thank you @ star001007 for reminding you that the quotation marks do not need to be filtered. The json string is originally caused. The initiator can directly use json_decode.