如上图我想得到一个二维数组关系的php $_POST对象时,即第行为一维数组,每行的每个值是第二维数组;
如想得到
array(1) {
["where"]=>
array(2) {
[0]=>
array(4) {
["rowPre"]=>
string(2) "or"
[0]=>
array(3) {
["filed"]=>
string(9) "undefined"
["rowRow"]=>
string(0) ""
["rowVal"]=>
string(0) ""
}
[1]=>
array(4) {
["cellContact"]=>
string(2) "or"
["filed"]=>
string(9) "undefined"
["rowRow"]=>
string(0) ""
["rowVal"]=>
string(0) ""
}
[2]=>
array(4) {
["cellContact"]=>
string(2) "or"
["filed"]=>
string(9) "undefined"
["rowRow"]=>
string(0) ""
["rowVal"]=>
string(0) ""
}
}
[1]=>
array(4) {
["rowPre"]=>
string(2) "or"
[0]=>
array(3) {
["filed"]=>
string(19) "where[0][0][rowRow]"
["rowRow"]=>
string(0) ""
["rowVal"]=>
string(0) ""
}
[1]=>
array(4) {
["cellContact"]=>
string(2) "or"
["filed"]=>
string(19) "where[0][1][rowRow]"
["rowRow"]=>
string(0) ""
["rowVal"]=>
string(0) ""
}
[2]=>
array(4) {
["cellContact"]=>
string(2) "or"
["filed"]=>
string(19) "where[0][2][rowRow]"
["rowRow"]=>
string(0) ""
["rowVal"]=>
string(0) ""
}
}
}
}
必须提交数据是这样的.
where[0][0][filed]undefinedwhere[0][0][rowRow]where[0][0][rowVal]
where[0][1][cellContact]orwhere[0][1][filed]undefinedwhere[0][1][rowRow]
where[0][1][rowVal]
where[0][2][cellContact]orwhere[0][2][filed]undefinedwhere[0][2][rowRow]
where[0][2][rowVal]
where[0][rowPre]orwhere[1][0][filed]where[0][0][rowRow]where[1][0][rowRow]
where[1][0][rowVal]
where[1][1][cellContact]orwhere[1][1][filed]where[0][1][rowRow]where[1][1][rowRow]
where[1][1][rowVal]
where[1][2][cellContact]orwhere[1][2][filed]where[0][2][rowRow]where[1][2][rowRow]
where[1][2][rowVal]
where[1][rowPre]or
html控件写法
<input name="where[1][rowPre]" />
如果写成
where[1][rowPre][]
那么它跟
$array[] = '';
是一样的效果的.
而
where[1][rowPre]
跟
$where[1][rowPre] = ''
是相同效果
而
where[1][rowPre]xyz
却是错误的name写法.php不认.