我想从我的存储桶中删除特定对象。我用这个代码删除。但这不适合我。
use Aws\S3\S3Client;
$s3 = S3Client::factory(array(
'key' => CONTENT_KEY,
'secret' => CONTENT_SECRET
));
$keyname = "/".CONTENT_PATH."/magazinename";
if ($s3->deleteObject(CONTENT_BUCKET, $keyname)) {
echo "Deleted file.";
}
发出错误
Catchable fatal error: Argument 2 passed to Guzzle\Service\Client::getCommand() must be an array
如果有人知道这个,请帮助我。 提前致谢
答案 0 :(得分:2)
$bucket = '*** Your Bucket Name ***';
$keyname = '*** Your Object Key ***';
$result = $s3->deleteObject(array(
'Bucket' => $bucket,
'Key' => $keyname));
http://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingOneObjectUsingPHPSDK.html