這不是相對於zend框架,它是相對於PHP的基礎。
For循環成多個陣列,你可以這樣做:
array(
1 => array(
'formdata' => {"profilename":"test"}
'fileUpload' => array(
'file' => array(
'name' => '108-thumb_709.jpg',
'type' => 'image/jpeg',
'tmp_name' => '/tmp/phpg1PQRN',
'error' => '0',
'size' => '62869',
)
)
),
2 => array(
'formdata' => {"profilename":"test"}
'fileUpload' => array(
'file' => array(
'name' => '108-thumb_709.jpg',
'type' => 'image/jpeg',
'tmp_name' => '/tmp/phpg1PQRN',
'error' => '0',
'size' => '62869',
)
)
),
);
:
<?php
foreach ($myArray['fileUpload'] as $file) {
var_dump($file['name']),
}
如果你有一個這樣的結構,你可以看看到this question而this PHP manual for foreach
你必須這樣做:
foreach ($myArray as $key => $value) {
foreach ($value['fileUpload'] as $file) {
var_dump($file['name']),
}
}
你解決了你的問題嗎?我的答案有幫助?謝謝你給我一個feddback plz。 – Hooli