Files
plugins/QNUpload/Qiniu/rsf.php
chorblack e75f275ef4
Some checks failed
定时更新GitHub源插件 / 自动更新GitHub插件 (push) Has been cancelled
Initial commit
2026-03-07 11:19:25 +08:00

44 lines
1013 B
PHP
Raw 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("http.php");
define('Qiniu_RSF_EOF', 'EOF');
/**
* 1. 首次请求 marker = ""
* 2. 无论 err 值如何,均应该先看 items 是否有内容
* 3. 如果后续没有更多数据err 返回 EOFmarkerOut 返回 ""(但不通过该特征来判断是否结束)
*/
function Qiniu_RSF_ListPrefix(
$self, $bucket, $prefix = '', $marker = '', $limit = 0) // => ($items, $markerOut, $err)
{
global $QINIU_RSF_HOST;
$query = array('bucket' => $bucket);
if (!empty($prefix)) {
$query['prefix'] = $prefix;
}
if (!empty($marker)) {
$query['marker'] = $marker;
}
if (!empty($limit)) {
$query['limit'] = $limit;
}
$url = $QINIU_RSF_HOST . '/list?' . http_build_query($query);
list($ret, $err) = Qiniu_Client_Call($self, $url);
if ($err !== null) {
return array(null, '', $err);
}
$items = $ret['items'];
if (empty($ret['marker'])) {
$markerOut = '';
$err = Qiniu_RSF_EOF;
} else {
$markerOut = $ret['marker'];
}
return array($items, $markerOut, $err);
}