rsf_v2list_bucket.php 768 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use Qiniu\Auth;
  4. use Qiniu\Storage\BucketManager;
  5. // http://developer.qiniu.com/docs/v6/api/reference/rs/list.html#list-description
  6. $accessKey = getenv('QINIU_ACCESS_KEY');
  7. $secretKey = getenv('QINIU_SECRET_KEY');
  8. $bucket = 'xxxx';
  9. $auth = new Auth($accessKey, $secretKey);
  10. $bucketManager = new BucketManager($auth);
  11. // 要列取文件的公共前缀
  12. $prefix = '';
  13. // 上次列举返回的位置标记,作为本次列举的起点信息。
  14. $marker = '';
  15. // 本次列举的条目数
  16. $limit = 1000;
  17. $delimiter = '';
  18. list($ret, $err) = $bucketManager->listFilesv2($bucket, $prefix, $marker, $limit, $delimiter, true);
  19. if ($err) {
  20. print_r($err);
  21. } else {
  22. print_r($ret);
  23. }