bucket_lifecycleRule.php 601 B

123456789101112131415161718192021222324252627282930
  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. $bucket = 'xxxx';
  10. $name = 'demo';
  11. $prefix = 'test';
  12. $delete_after_days = 80;
  13. $to_line_after_days =70;
  14. list($Info, $err) = $bucketManager->bucketLifecycleRule(
  15. $bucket,
  16. $name,
  17. $prefix,
  18. $delete_after_days,
  19. $to_line_after_days
  20. );
  21. if ($err) {
  22. print_r($err);
  23. } else {
  24. print_r($Info);
  25. }