作者 lyh

gx

@@ -70,10 +70,16 @@ class AmazonS3Service @@ -70,10 +70,16 @@ class AmazonS3Service
70 $key = str_replace_url($files); 70 $key = str_replace_url($files);
71 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($key, true) . PHP_EOL, FILE_APPEND); 71 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($key, true) . PHP_EOL, FILE_APPEND);
72 // try { 72 // try {
  73 + $context = stream_context_create([
  74 + "ssl" => [
  75 + "verify_peer" => false, // 关闭对对等证书的验证
  76 + "verify_peer_name" => false, // 关闭对主机名的验证
  77 + ],
  78 + ]);
73 $result = $this->s3->putObject([ 79 $result = $this->s3->putObject([
74 'Bucket' => $this->bucket, 80 'Bucket' => $this->bucket,
75 'Key' => $key, 81 'Key' => $key,
76 - 'Body' => file_get_contents($files), 82 + 'Body' => file_get_contents($files, false, $context),
77 ]); 83 ]);
78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($result, true) . PHP_EOL, FILE_APPEND); 84 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($result, true) . PHP_EOL, FILE_APPEND);
79 return $result['ObjectURL']; 85 return $result['ObjectURL'];