|
...
|
...
|
@@ -69,7 +69,7 @@ class AmazonS3Service |
|
|
|
$file_link = $this->fetchRemoteImage($files);
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('图片:'.$file_link, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$key = str_replace_url($files);
|
|
|
|
// try {
|
|
|
|
try {
|
|
|
|
$context = stream_context_create([
|
|
|
|
'ssl' => [
|
|
|
|
'verify_peer' => false,
|
|
...
|
...
|
@@ -79,13 +79,13 @@ class AmazonS3Service |
|
|
|
$file_content = file_get_contents($file_link, false, $context);
|
|
|
|
$result = $this->s3->putObject([
|
|
|
|
'Bucket' => $this->bucket,
|
|
|
|
'Key' => $key,
|
|
|
|
'Key' => ltrim($key,'/'),
|
|
|
|
'Body' => $file_content,
|
|
|
|
]);
|
|
|
|
return $result['ObjectURL'];
|
|
|
|
// } catch (AwsException $e) {
|
|
|
|
// return '上传文件到S3时发生错误:' . $e->getMessage();
|
|
|
|
// }
|
|
|
|
} catch (AwsException $e) {
|
|
|
|
return '上传文件到S3时发生错误:' . $e->getMessage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|