作者 刘锟

update

... ... @@ -192,7 +192,7 @@ if (!function_exists('curl_c')) {
if($http_code == 200){
return $is_array ? json_decode($content, true) : $content;
}else{
return $http_code;
return false;
}
}
}
... ...
... ... @@ -132,9 +132,18 @@ class CosService
],
]);
try {
$body = $body_str ?:curl_c($file_url,false);
}catch (\Exception $e){
if(empty($body_str)){
try {
$body_str = curl_c($file_url,false);
if(!$body_str){
$body_str = file_get_contents($file_url);
}
}catch (\Exception $e){
$body_str = '';
}
}
if(!$body_str){
return '';
}
... ... @@ -142,7 +151,7 @@ class CosService
$cosClient->putObject([
'Bucket' => $cos['bucket'],
'Key' => $key,
'Body' => $body,
'Body' => $body_str,
]);
return $key;
}catch (\Exception $e){
... ...