php 与 <input name="xx[]"数组格式传递关系

php 与 lt;input name=quot;xx[]quot;数组格式传递关系 - qidizi - qidizi 的博客

如上图我想得到一个二维数组关系的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不认.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值