shop-php/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php

31 lines
601 B
PHP
Raw Normal View History

2023-05-10 13:39:12 +08:00
<?php
require_once __DIR__ . '/../autoload.php';
use Qiniu\Auth;
$accessKey = getenv('QINIU_ACCESS_KEY');
$secretKey = getenv('QINIU_SECRET_KEY');
$auth = new Auth($accessKey, $secretKey);
2024-02-28 16:51:38 +08:00
$config = new \Qiniu\Config();
$bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
2023-05-10 13:39:12 +08:00
2024-02-28 16:51:38 +08:00
$bucket = 'xxxx';
$name = 'demo';
$prefix = 'test';
$delete_after_days = 80;
$to_line_after_days =70;
2023-05-10 13:39:12 +08:00
2024-02-28 16:51:38 +08:00
list($Info, $err) = $bucketManager->bucketLifecycleRule(
2023-05-10 13:39:12 +08:00
$bucket,
$name,
$prefix,
$delete_after_days,
2024-02-28 16:51:38 +08:00
$to_line_after_days
2023-05-10 13:39:12 +08:00
);
2024-02-28 16:51:38 +08:00
if ($err) {
print_r($err);
2023-05-10 13:39:12 +08:00
} else {
2024-02-28 16:51:38 +08:00
print_r($Info);
2023-05-10 13:39:12 +08:00
}