删除多个对象
您可以使用 deleteObjects 接口删除多个对象,以下代码展示如何删除多个对象:
$bucket = '<your-bucket-name>';
$keys = ['<object-key1>', '<object-key2>', '<object-key3>'];
$s3->deleteObjects([
'Bucket' => $bucket,
'Delete' => [
'Objects' => array_map(function ($key) {
return ['Key' => $key];
}, $keys)
],
]);