作者 lyh

gx

... ... @@ -69,7 +69,7 @@ class AmazonS3Service
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($files, true) . PHP_EOL, FILE_APPEND);
$key = str_replace_url($files);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($key, true) . PHP_EOL, FILE_APPEND);
try {
// try {
$result = $this->s3->putObject([
'Bucket' => $this->bucket,
'Key' => $key,
... ... @@ -77,9 +77,9 @@ class AmazonS3Service
]);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($result, true) . PHP_EOL, FILE_APPEND);
return $result['ObjectURL'];
} catch (AwsException $e) {
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('图片:'.$e->getMessage(), true) . PHP_EOL, FILE_APPEND);
return '上传文件到S3时发生错误:' . $e->getMessage();
}
// } catch (AwsException $e) {
// @file_put_contents(storage_path('logs/lyh_error.log'), var_export('图片:'.$e->getMessage(), true) . PHP_EOL, FILE_APPEND);
// return '上传文件到S3时发生错误:' . $e->getMessage();
// }
}
}
... ...