我有一个多维数组
(Array ( [filenames] => Array ( [0] => 2.jpeg [1] => 3.jpeg ) [sizes] => Array ( [0] => 0.00 MB [1] => 0.00 MB ) [temp_names] => Array ( [0] => /private/var/folders/np/sln14hvn3tsbzc4kpjjtp17c0000gn/T/phpLVhmBY [1] => /private/var/folders/np/sln14hvn3tsbzc4kpjjtp17c0000gn/T/phpoifsg0 ) [uploads] => Array ( [0] => /Users/sandro/Documents/bildgalerie/uploads/2.jpeg [1] => /Users/sandro/Documents/bildgalerie/uploads/3.jpeg ) ))
我想使用foreach从特定键(例如“文件名”)中获取所有值。
这是数组的一部分:
$uploadData = array(
'filenames' => array(),
'sizes' => array(),
'temp_names' => array(),
'uploads' => array()
);
这段代码还行不通,但是我不知道为什么:(
foreach ($uploadData as $row) {
if (move_uploaded_file($row['temp_names'], $location . '/' . basename($row['filenames']))) {
echo 'File uploaded.';
echo '<br>';
}
}
错误: Notice: Undefined index: filenames in X on line X
心有法竹