get_bucketinfos.php 428 B

1234567891011121314151617181920
  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. $auth = new Auth($accessKey, $secretKey);
  7. $config = new \Qiniu\Config();
  8. $bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
  9. $region = 'z1';
  10. list($Info, $err) = $bucketManager->bucketInfos($region);
  11. if ($err) {
  12. print_r($err);
  13. } else {
  14. print_r($Info);
  15. }