PHP数组里面的值取不出来。该如何处理
程序员文章站
2022-04-17 19:05:46
...
PHP数组里面的值取不出来。。
用POST提交表单之后:
var_dump($_POST);
输出POST数组的值可以看到:
array(10) { ["picName"]=> array(2) { [0]=> string(33) "p_large_18SQ_6bcc000198902d14.jpg" [1]=> string(33) "p_large_4u3y_64f80006f4305c40.jpg" } ["p_large_18SQ_6bcc000198902d14_jpgtop"]=> string(5) "290px" ["p_large_18SQ_6bcc000198902d14_jpgleft"]=> string(5) "454px" ["p_large_18SQ_6bcc000198902d14_jpgheight"]=> string(3) "236" ["p_large_18SQ_6bcc000198902d14_jpgwidth"]=> string(3) "150" ["p_large_4u3y_64f80006f4305c40_jpgtop"]=> string(5) "100px" ["p_large_4u3y_64f80006f4305c40_jpgleft"]=> string(5) "500px" ["p_large_4u3y_64f80006f4305c40_jpgheight"]=> string(3) "150" ["p_large_4u3y_64f80006f4305c40_jpgwidth"]=> string(3) "150" ["num"]=> string(1) "2" }
但是之后再取出POST里面的值的时候,例如_POST[" p_large_18SQ_6bcc000198902d14.jpgtop"]
就会报错:Notice: Undefined index: p_large_18SQ_6bcc000198902d14.jpgtop
可是丫明明在_POST里面啊这是为神马啊= =|||||
------解决方案--------------------
是的,提交的变量名中的 “.”会变成“_”
用POST提交表单之后:
var_dump($_POST);
输出POST数组的值可以看到:
array(10) { ["picName"]=> array(2) { [0]=> string(33) "p_large_18SQ_6bcc000198902d14.jpg" [1]=> string(33) "p_large_4u3y_64f80006f4305c40.jpg" } ["p_large_18SQ_6bcc000198902d14_jpgtop"]=> string(5) "290px" ["p_large_18SQ_6bcc000198902d14_jpgleft"]=> string(5) "454px" ["p_large_18SQ_6bcc000198902d14_jpgheight"]=> string(3) "236" ["p_large_18SQ_6bcc000198902d14_jpgwidth"]=> string(3) "150" ["p_large_4u3y_64f80006f4305c40_jpgtop"]=> string(5) "100px" ["p_large_4u3y_64f80006f4305c40_jpgleft"]=> string(5) "500px" ["p_large_4u3y_64f80006f4305c40_jpgheight"]=> string(3) "150" ["p_large_4u3y_64f80006f4305c40_jpgwidth"]=> string(3) "150" ["num"]=> string(1) "2" }
但是之后再取出POST里面的值的时候,例如_POST[" p_large_18SQ_6bcc000198902d14.jpgtop"]
就会报错:Notice: Undefined index: p_large_18SQ_6bcc000198902d14.jpgtop
可是丫明明在_POST里面啊这是为神马啊= =|||||
------解决方案--------------------
是的,提交的变量名中的 “.”会变成“_”
相关文章
相关视频