1 < input name="a[]" value="1" /> 2 < input name="a[]" value="2" /> 3 < input name="a[]" value="3" /> 4 $_POST结果为: 5 Array 6 ( 7 [a] => Array 8 ( 9 [0] => 1 10 [1] => 2 11 [2] => 3 12 ) 13 )
那么如果这样命名表单:
1 < input name="a[2]" value="1" /> 2 < input name="a[5]" value="2" /> 3 < input name="a[9]" value="3" /> 4 $_POST输出结果为: 5 Array 6 ( 7 [a] => Array 8 ( 9 [2] => 1 10 [5] => 2 11 [9] => 3 12 ) 13 )
继续测试PHP表单数组:
1 < input name="a[aa]" value="1" /> 2 < input name="a[bb]" value="2" /> 3 < input name="a[cc]" value="3" /> 4 5 $_POST输出结果为: 6 Array 7 ( 8 [a] => Array 9 ( 10 [aa] => 1 11 [bb] => 2 12 [cc] => 3 13 ) 14 )
时间: 2024-11-11 23:57:05