我需要将2个多维数组合并在一起以创建一个新数组。这两个数组是从$_POST和创建的$_FILES,我需要将它们彼此关联。数组#1Array ( [0] => Array ( [0] => 123 [1] => "Title #1" [2] => "Name #1" ) [1] => Array ( [0] => 124 [1] => "Title #2" [2] => "Name #2" ))阵列#2Array( [name] => Array ( [0] => Image001.jpg [1] => Image002.jpg ))新阵列Array( [0] => Array ( [0] => 123 [1] => "Title #1" [2] => "Name #1" [3] => "Image001.jpg" ) [1] => Array ( [0] => 124 [1] => "Title #2" [2] => "Name #2" [3] => "Image002.jpg" ))我正在使用的当前代码有效,但仅适用于数组中的最后一项。我想通过循环该array_merge函数在每个循环中擦除新数组。$i=0;$NewArray = array();foreach($OriginalArray as $value) { $NewArray = array_merge($value,array($_FILES['Upload']['name'][$i])); $i++;}我该如何纠正?
3 回答
- 3 回答
- 0 关注
- 1488 浏览
添加回答
举报
0/150
提交
取消