作者 lyh

gx

... ... @@ -70,19 +70,13 @@ class AmazonS3Service
$file_link = $this->fetchRemoteImage($files,$location);
$key = str_replace_url($files);
try {
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
]);
$file_content = file_get_contents($file_link, false, $context);
$file_content = file_get_contents($file_link);
$result = $this->s3->putObject([
'Bucket' => $this->bucket,
'Key' => ltrim($key,'/'),
'Body' => $file_content,
]);
unlink($location);
// unlink($location);
return $result['ObjectURL'];
} catch (AwsException $e) {
return '上传文件到S3时发生错误:' . $e->getMessage();
... ...