简体   繁体   中英

How to retrieve folder files from Google Cloud using PHP client library?

I want to retrieve all files of a folder in Google Cloud Storage. I searched a lot but cannot found anything. I have tried this:

$bucket = $storageService->objects->get(DEFAULT_BUCKET,"myfolder/",array());
$getBucketMarkup = generateMarkup('Get Bucket', $bucket);

print_r($getBucketMarkup);

I have solved it by putting two parameters of List Objects in array one Is delimiter and the second one is prefix

$bucket = $storageService->objects->listObjects(DEFAULT_BUCKET,array(
    "delimiter"=>"/",
    "prefix"=>$folder_name
    ));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM