如何将接收到的数组转成如下格式?
<input type="text" name="name[]" value="姓名" />
<input type="text" name="age[]" value="15" />
<input type="text" name="name[]" value="姓名" />
<input type="text" name="age[]" value="15" />我要怎么接收,才能成这样的数组?pic=>(
* 0=>array(
* name=>姓名
* age=>15
* ),
0=>array(
* name=>姓名
* age=>30
* ),
Array
(
[url] => Array
(
[0] => /uploads/13534190820.84986000.jpg
[1] => /uploads/13534190830.00999000.jpg
[2] => /uploads/13534190830.09639600.jpg
[3] => /uploads/13534190830.18655000.jpg
)
[alt] => Array
(
[0] => 24234
[1] => 23423
[2] => 424
[3] => 24234
)
)
foreach($_POST['name'] as $k=>$v){
$arr[]=array('name'=>$v,'age'=>$_POST['age'][$k]);
}
print_r($arr);
Array
(
[0] => Array
(
[url] => /uploads/1562313.84986000.jpg
[alt]=>24234
)
[1] => Array
(
[url] => /uploads/913213.84986000.jpg
[alt]=>9832132132
)
[2] => Array
(
[url] => /uploads/65132.84986000.jpg
[alt]=>1236136569
)
)