以下是我删除Amazon S3
图片文件的代码:
<?php
$s3 = new S3(awsAccessKey, awsSecretKey);
$del1 = $s3->deleteObject($bucket,$newfilename);
$del2 = $s3->deleteObject($thumb_bucket,$newfilename);
public static function deleteObject($bucket, $uri)
{
$rest = new S3Request('DELETE', $bucket, $uri, self::$endpoint);
$rest = $rest->getResponse();
if ($rest->error === false && $rest->code !== 204)
$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
if ($rest->error !== false)
{
self::__triggerError(sprintf("S3::deleteObject(): [%s] %s",
$rest->error['code'], $rest->error['message']), __FILE__, __LINE__);
return false;
}
return true;
}
?>
在此,我 输出 ,但 形成我的存储桶,不会被删除 。任何解决方案?