我想检查是否存在特定的存储桶,如果不创建新存储桶。
我需要知道如何使用 aws.phar + php 检测存储桶是否已存在
这是伪代码
$bucket = 'my-bucket';
//some code to detect if bucket name 'my-bucket' exists *suggest here*
//$myBucketExists = $client->someMethode()
if(!$myBucketExists){
$result = $client->createBucket(array(
'Bucket' => $bucket
));
// Wait until the bucket is created
$client->waitUntil('BucketExists', array('Bucket' => $bucket));
}
// rest of the code using the bucket