2011-11-06 81 views

回答

1

見例如#5:

http://framework.zend.com/manual/en/zend.service.amazon.s3.html

getObjectsByBucket($桶)返回對象鍵列表, 包含在桶。

$s3 = new Zend_Service_Amazon_S3($my_aws_key, $my_aws_secret_key); 

$list = $s3->getObjectsByBucket("my-own-bucket"); 
foreach($list as $name) { 
    echo "I have $name key:\n"; 
    $data = $s3->getObject("my-own-bucket/$name"); 
    echo "with data: $data\n"; 
} 

更新:

「文件夾」 在Amazon S3中的前綴,你可以設置一個PARAM:

prefix - Limits the response to keys which begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders. 

見S3.php

+0

線#293我確實看到了這一點,但如果我在一個桶中有幾千個目錄,那麼性能通過真正的_each_目錄會有點不好。我希望已經有類似s3-> listFiles('my-own-bucket/directory1/directory2'); –

+0

@dotwired你可以設置使用參數獲得哪個文件夾,查看更新的答案 – Ashley

+0

真棒,謝謝! –

相關問題