Keine Beschreibung

delete_bucketEvent.php 804B

1234567891011121314151617181920212223242526272829
  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. $auth = new Auth($accessKey, $secretKey);
  10. $config = new Config();
  11. $bucketManager = new BucketManager($auth, $config);
  12. // 删除 bucket 事件通知规则
  13. // 参考文档:https://developer.qiniu.com/kodo/manual/6095/event-notification
  14. $bucket = 'xxxx'; // 存储空间名称
  15. $name = 'demo'; // 规则名称 bucket 内唯一,由 1 ~ 50 个字符组成,可包含:字母、数字和下划线
  16. list($ret, $err) = $bucketManager->deleteBucketEvent($bucket, $name);
  17. if ($err != null) {
  18. var_dump($err);
  19. } else {
  20. var_dump($ret);
  21. }