mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
35 lines
834 B
PHP
35 lines
834 B
PHP
<?php
|
|
require_once __DIR__ . '/../autoload.php';
|
|
|
|
use Qiniu\Auth;
|
|
use Qiniu\Storage\BucketManager;
|
|
|
|
$accessKey = 'Access_Key';
|
|
$secretKey = 'Secret_Key';
|
|
$auth = new Auth($accessKey, $secretKey);
|
|
$bucketMgr = new BucketManager($auth);
|
|
|
|
// http://developer.qiniu.com/docs/v6/api/reference/rs/list.html#list-description
|
|
// 要列取的空间名称
|
|
$bucket = 'Bucket_Name';
|
|
|
|
// 要列取文件的公共前缀
|
|
$prefix = '';
|
|
|
|
// 上次列举返回的位置标记,作为本次列举的起点信息。
|
|
$marker = '';
|
|
|
|
// 本次列举的条目数
|
|
$limit = 3;
|
|
|
|
// 列举文件
|
|
list($iterms, $marker, $err) = $bucketMgr->listFiles($bucket, $prefix, $marker, $limit);
|
|
if ($err !== null) {
|
|
echo "\n====> list file err: \n";
|
|
var_dump($err);
|
|
} else {
|
|
echo "Marker: $marker\n";
|
|
echo "\nList Iterms====>\n";
|
|
var_dump($iterms);
|
|
}
|