Files
Qiniu/php-sdk/examples/cdn_get_refresh_list.php
2026-02-23 19:48:13 +08:00

49 lines
1.5 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once __DIR__ . '/../autoload.php';
use Qiniu\Auth;
use Qiniu\Cdn\CdnManager;
// 控制台获取密钥https://portal.qiniu.com/user/key
$accessKey = getenv('QINIU_ACCESS_KEY');
$secretKey = getenv('QINIU_SECRET_KEY');
$auth = new Auth($accessKey, $secretKey);
$cdnManager = new CdnManager($auth);
// 查询 CDN 刷新记录
// 参考文档https://developer.qiniu.com/fusion/api/1229/cache-refresh#4
$requestId = 'xxxxxx'; // 指定要查询记录所在的刷新请求id
$isDir = 'no'; // 指定是否查询目录取值为yes/no默认不填则为两种类型记录都查询
// 要查询的url列表每个url可以是文件url也可以是目录url
$urls = array(
"http://sdk.peterpy.cn/sdktest.png",
"http://sdk.peterpy.cn/qiniulogo.png"
);
$state = 'success'; // 指定要查询记录的状态,取值 processingsuccessfailure
$pageNo = 0; // 要求返回的页号默认为0
$pageSize = 100; // 要求返回的页长度默认为100
$startTime = '2020-09-11 12:00:00'; // 指定查询的开始日期格式2006-01-01
$endTime = '2020-09-20 21:00:00'; // 指定查询的结束日期格式2006-01-01
list($ret, $err) = $cdnManager->getCdnRefreshList(
$requestId,
$isDir,
$urls,
$state,
$pageNo,
$pageSize,
$startTime,
$endTime
);
echo "\n====> query refresh list: \n";
if ($err !== null) {
var_dump($err);
} else {
var_dump($ret);
}