我有,因为它没有显示我希望它的方式与下面的阵列的一个问题;
Array
(
[0] => Array
(
[name] => Accounts.csv
[time] => 1396518749
[size] => 4685
[hash] => 4ddde7286adcbf06472a7d8f9987bf88
)
[1] => Array
(
[name] => Book1.xlsx
[time] => 1396436339
[size] => 9776
[hash] => 96f219be0397b240777969f8b3cbb711
)
[2] => Array
(
[name] => Documents/
[time] => 1396510415
[size] => 0
[hash] => d41d8cd98f00b204e9800998ecf8427e
)
[3] => Array
(
[name] => Documents/AdbWinApi.dll
[time] => 1396847400
[size] => 96256
[hash] => 47a6ee3f186b2c2f5057028906bac0c6
)
[4] => Array
(
[name] => ken header.pdf
[time] => 1396436334
[size] => 110772
[hash] => fe64e53a2237c7b84b08981ed2c0447a
)
[5] => Array
(
[name] => sp42471.exe
[time] => 1396527931
[size] => 128609088
[hash] => 1687428c91011b0c028f91d16593c5e7
)
)
我想,如下去除一些重复的项目和重组的输出;
Array
(
[0] => Array
(
[name] => Accounts.csv
[time] => 1396518749
[size] => 4685
[hash] => 4ddde7286adcbf06472a7d8f9987bf88
)
[1] => Array
(
[name] => Book1.xlsx
[time] => 1396436339
[size] => 9776
[hash] => 96f219be0397b240777969f8b3cbb711
)
[2] => Array
(
[name] => Documents
[time] => 1396510415
[size] => 0
[hash] => d41d8cd98f00b204e9800998ecf8427e
)
[3] => Array
(
[name] => ken header.pdf
[time] => 1396436334
[size] => 110772
[hash] => fe64e53a2237c7b84b08981ed2c0447a
)
[4] => Array
(
[name] => sp42471.exe
[time] => 1396527931
[size] => 128609088
[hash] => 1687428c91011b0c028f91d16593c5e7
)
)
我使用下面的代码检索数组。
private function listFiles($bucket = null , $prefix = null) {
$ls = S3::getBucket($bucket, $prefix);
if(!empty($ls)) {
foreach($ls as $l) {
//print_r($ls);
$fname = str_replace($prefix,"",$l['name']);
$ftime = $l['time'];
$fsize = $l['size'];
$fhash = $l['hash'];
if(!empty($fname)) {
$rv[] = array('name' => $fname, 'time' => $ftime, 'size' => $fsize, 'hash' => $fhash);
//$rv[] = $fname;
}
}
}
if(!empty($rv)) {
return $rv;
}
}
哪一部分,我应该修改以获得上述结果。 注:我还是新来的数组的东西。