我正在使用S3 php sdk和larval实现这个将对象放到S3上.
try {
$s3->putObject(array(
'Bucket' => 'mybucket',
'Key' => 'abc',
'Body' => $img->encode(null, 90),
'ACL' => 'public-read',
'ContentType' => $img->mime()
));
}
catch (S3Exception $e) {
var_dump('error');
die();
}
Run Code Online (Sandbox Code Playgroud)
但上面的代码似乎没有发现错误.我设置了一个不正确的桶,我仍然得到错误:
type:Aws\S3\Exception\NoSuchBucketException, message:The specified bucket does not exist,…
Run Code Online (Sandbox Code Playgroud)
如何捕获此错误并相应地执行操作.