删除单个对象

您可以使用 deleteObject 接口删除单个对象,以下代码展示如何删除一个对象:

$bucket = '<your-bucket-name>';
$keyname = '<your-object-key>';
try {
    $result = $s3Client->deleteObject([
        'Bucket' => $bucket,
        'Key' => $keyname,
    ]);
} catch (S3Exception $e) {
    echo $e->getMessage() . "\n";
}