S3存储桶的内容是没有得到上市到最后内容

2023-09-11 23:50:34 作者:心悦君兮君不知

我开始使用foreach循环列出了S3存储桶的内容。

I started listing the contents of a S3 bucket using foreach loop.

$contents = $s3->getBucket("bucket-name");
foreach($contents as $value) 
    {
      print $value['name']; echo "<br>"; 
    }

但问题是,它不高于1000的索引列表。最后几个文件没有列出。 我试图让数组的长度,我发现,过去几年的文件甚至没有得到存储在该数组中。

But the problem is that it is not listing above 1000 index. The last few files are not listing. I tried getting the length of the array and I found that last few files are not even getting stored in that array.

我应该怎么做全部列出来?

What should I do to list them all?

推荐答案

中列出的文件的默认数量设置为1000,所以这就是为什么你不能超过1000个文件:

The default number of listed files is set to 1000, so thats why you cannot get more than 1000 files:

在这里,你有一个函数的说明:

Here you have a description of a function:

public static function getBucket($bucket, $prefix = null, $marker = null, $maxKeys = null, $delimiter = null) {

使用 $标记来设定从哪里开始获取文件和 $ maxKeys 为限。

Use $marker to set where to start getting files and $maxKeys as a limit.

WWW:http://www.drupalcontrib.org/api/drupal/contributions!media_mover!contrib!mm_s3!S3.php/function/S3%3A%3AgetBucket/6

如果您使用相同的库。