rs_buckets.php 450 B

12345678910111213141516171819
  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. list($buckets, $err) = $bucketManager->buckets(true);
  11. if ($err) {
  12. print_r($err);
  13. } else {
  14. print_r($buckets);
  15. }