获取 Google Cloud Storage 中的文件列表(Appengine PHP)

我有一个 Google Cloud Storage 存储桶MyBucket",它有 20 个项目.我想在我的 appengine PHP 应用程序中获取这些文件名.

I have a Google Cloud Storage bucket "MyBucket" and it have 20 items. I would like to get those file name in my appengine PHP application.

我正在寻找是否可以使用 App Engine 的内置 Google Cloud Storage (GCS) 流包装器获取列表.

I'm Looking whether we can get the list using App Engine's built-in Google Cloud Storage (GCS) stream wrapper.

类似这样的:

require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php';
use googleappengineapicloud_storageCloudStorageTools;

$bucket_name = 'gs://my-bucket/';
$file_list = CloudStorageTools::list($bucket_name); //Won't Work. Function like this

推荐答案

基于参考.CloudStorateTools 的文档 没有像列出文件这样的东西.考虑使用不同的 API 来访问 Google Cloud Storage,例如 JSON API.对于列表功能,您可以查看此 链接.

based on ref. documentation for CloudStorateTools there is no such thing like listing files. Consider to use different API for accessing Google Cloud Storage like JSON API. For list function you can check this link.

相关文章