rs_batch_stat.php 599B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use \Qiniu\Auth;
  4. $accessKey = getenv('QINIU_ACCESS_KEY');
  5. $secretKey = getenv('QINIU_SECRET_KEY');
  6. $bucket = getenv('QINIU_TEST_BUCKET');
  7. $auth = new Auth($accessKey, $secretKey);
  8. $config = new \Qiniu\Config();
  9. $bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
  10. //每次最多不能超过1000个
  11. $keys = array(
  12. 'qiniu.mp4',
  13. 'qiniu.png',
  14. 'qiniu.jpg'
  15. );
  16. $ops = $bucketManager->buildBatchStat($bucket, $keys);
  17. list($ret, $err) = $bucketManager->batch($ops);
  18. if ($err) {
  19. print_r($err);
  20. } else {
  21. print_r($ret);
  22. }