作者 刘锟

upload_remote

... ... @@ -2,6 +2,7 @@
namespace App\Services;
use App\Utils\LogUtils;
use Qcloud\Cos\Client;
/**
* @remark :对象存储cos
... ... @@ -88,12 +89,16 @@ class CosService
],
]);
$key = $path.'/'.$filename;
try {
$cosClient->putObject([
'Bucket' => $cos['bucket'],
'Key' => $key,
'Body' => fopen($file_url, 'r'),
]);
return $key;
}catch (\Exception $e){
LogUtils::error('uploadRemote error', $e->getMessage());
}
}
}
... ...