正在显示
1 个修改的文件
包含
2 行增加
和
8 行删除
| @@ -70,19 +70,13 @@ class AmazonS3Service | @@ -70,19 +70,13 @@ class AmazonS3Service | ||
| 70 | $file_link = $this->fetchRemoteImage($files,$location); | 70 | $file_link = $this->fetchRemoteImage($files,$location); |
| 71 | $key = str_replace_url($files); | 71 | $key = str_replace_url($files); |
| 72 | try { | 72 | try { |
| 73 | - $context = stream_context_create([ | ||
| 74 | - 'ssl' => [ | ||
| 75 | - 'verify_peer' => false, | ||
| 76 | - 'verify_peer_name' => false | ||
| 77 | - ] | ||
| 78 | - ]); | ||
| 79 | - $file_content = file_get_contents($file_link, false, $context); | 73 | + $file_content = file_get_contents($file_link); |
| 80 | $result = $this->s3->putObject([ | 74 | $result = $this->s3->putObject([ |
| 81 | 'Bucket' => $this->bucket, | 75 | 'Bucket' => $this->bucket, |
| 82 | 'Key' => ltrim($key,'/'), | 76 | 'Key' => ltrim($key,'/'), |
| 83 | 'Body' => $file_content, | 77 | 'Body' => $file_content, |
| 84 | ]); | 78 | ]); |
| 85 | - unlink($location); | 79 | +// unlink($location); |
| 86 | return $result['ObjectURL']; | 80 | return $result['ObjectURL']; |
| 87 | } catch (AwsException $e) { | 81 | } catch (AwsException $e) { |
| 88 | return '上传文件到S3时发生错误:' . $e->getMessage(); | 82 | return '上传文件到S3时发生错误:' . $e->getMessage(); |
-
请 注册 或 登录 后发表评论