Нет описания

put_bucketQuota.php 732B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use Qiniu\Auth;
  4. use Qiniu\Config;
  5. use Qiniu\Storage\BucketManager;
  6. // 控制台获取密钥:https://portal.qiniu.com/user/key
  7. $accessKey = getenv('QINIU_ACCESS_KEY');
  8. $secretKey = getenv('QINIU_SECRET_KEY');
  9. $bucket = getenv('QINIU_TEST_BUCKET');
  10. $auth = new Auth($accessKey, $secretKey);
  11. $config = new Config();
  12. $bucketManager = new BucketManager($auth, $config);
  13. // 设置 bucket 配额
  14. // size 表示空间存储量配额,count 表示空间文件数配额,新创建的空间默认没有限额
  15. $size = 99999;
  16. $count = 99;
  17. list($ret, $err) = $bucketManager->putBucketQuota($bucket, $size, $count);
  18. if ($err != null) {
  19. var_dump($err);
  20. } else {
  21. var_dump($ret);
  22. }