The project uses thinkphp, the front-end framework with DWZ, the page constructs a two-dimensional array, as follows:
After submitting, print Noticetype This array, the result is:
Array
(
[9353] => Array ( ['msg'] => msg )[9784] => Array ( ['wechat'] => wechat )[10113] => Array ( ['email'] => email )
)
However, when using a loop to iterate over the above array, or output:
"$_post\[noticetype\]\[9784\][\ ' wechat\" this format
Instead of using a two-dimensional array for post?
Why can I print a complete two-dimensional array and not get a single value?
Reply content:
The project uses thinkphp, the front-end framework with DWZ, the page constructs a two-dimensional array, as follows:
After submitting, print Noticetype This array, the result is:
Array
(
[9353] => Array ( ['msg'] => msg )[9784] => Array ( ['wechat'] => wechat )[10113] => Array ( ['email'] => email )
)
However, when using a loop to iterate over the above array, or output:
"$_post\[noticetype\]\[9784\][\ ' wechat\" this format
Instead of using a two-dimensional array for post?
Why can I print a complete two-dimensional array and not get a single value?
Use your given data to simulate the problem of adding quotes to the values in the array when you submit the table.
I'll show you what I wrote with your data:
"; print_r($_POST); echo "
"; echo "-----------------------------------------------".""; echo $_POST['noticetype'][9353]['msg']."
"; echo $_POST['noticetype'][9784]['email']."
"; echo $_POST['noticetype'][10113]['wechat']."
"; echo "---------------------------------------------"."
"; foreach ($_POST['noticetype'] as $key => $value) { foreach ($value as $k => $v) { echo $v.'
'; } }} ?> index
Results show:
If you enclose the MSG in quotation marks
, the Foreach loop can fetch the value but $_POST['noticetype'][9353]['msg']
not the value.