ufile-phpsdk/v1/demo/listobjects.php
2022-08-29 21:31:35 +08:00

27 lines
763 B
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("../ucloud/proxy.php");
//存储空间名
$bucket = "your bucket";
//需要拉列表的目录前缀
$prefix = "path prefix";
//拉列表一般分页拉取每次拉取会返回一个marker用来作为下一次拉取的marker实现翻页拉取初始为""
//如果拉取到结尾:"IsTruncated":false,"NextMarker":""
$marker = "";
#默认分隔符,目前支持/ 和空字符;如果是空表示不区分目录递归返回列表;
$delimiter ="/";
//该接口拉取一个目录前缀下的目录、文件列表
list($data, $err) = UCloud_ListObjects($bucket, $prefix, $marker, 100, $delimiter);
if ($err) {
echo "error: " . $err->ErrMsg . "\n";
echo "code: " . $err->Code . "\n";
exit;
}
echo json_encode($data, 128);