我在下面的代码发送URL
$checkboxes = http_build_query($checkbox);
echo "<script> document.location.href='index.php?act=magento&checkboxes=".$checkboxes."';</script>";
我得到URL下面
http://localhost/importcsvproduct/index.php?act=magento&checkboxes=0=15&1=16&2=17&3=18&4=19&5=20&6=21&7=22&8=23&9=24
我的问题是如何接收这个上面的复选框数组?
数组$checkbox的输出在
Array
(
[0] => 15
[1] => 16
[2] => 17
[3] => 18
[4] => 19
[5] => 20
[6] => 21
[7] => 22
[8] => 23
[9] => 24
)
请尝试以下操作:
$checkbox = array(4,5,6,7,8); // Does your array look like this?
$checkboxes = http_build_query(array('checkboxes' => $checkbox));
echo "<script> document.location.href='index.php?act=magento&checkboxes=".$checkboxes."';</script>";
您应该能够通过使用$_GET['checkboxes']
:
$_GET['checkboxes'][0]
$_GET['checkboxes'][1]
...