作者 lyh

gx

@@ -44,7 +44,6 @@ class AmazonS3Service @@ -44,7 +44,6 @@ class AmazonS3Service
44 { 44 {
45 $key = $s3Key.'/'.$filename; 45 $key = $s3Key.'/'.$filename;
46 $body = $files->getRealPath(); 46 $body = $files->getRealPath();
47 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($files->getRealPath(), true) . PHP_EOL, FILE_APPEND);  
48 try { 47 try {
49 $result = $this->s3->putObject([ 48 $result = $this->s3->putObject([
50 'Bucket' => $this->bucket, 49 'Bucket' => $this->bucket,
@@ -52,8 +51,10 @@ class AmazonS3Service @@ -52,8 +51,10 @@ class AmazonS3Service
52 'SourceFile' => $body, 51 'SourceFile' => $body,
53 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改 52 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改
54 ]); 53 ]);
  54 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export('ok:'.$result['ObjectURL'], true) . PHP_EOL, FILE_APPEND);
55 return $result['ObjectURL']; 55 return $result['ObjectURL'];
56 } catch (S3Exception $e) { 56 } catch (S3Exception $e) {
  57 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export('失败', true) . PHP_EOL, FILE_APPEND);
57 return false; 58 return false;
58 } 59 }
59 } 60 }