作者 lyh

gx

... ... @@ -53,7 +53,7 @@ if (!function_exists('http_post')) {
* @param type $url
* @param type $post_data
*/
function http_post($url, $post_data, $header = [])
function http_post($url, $post_data, $header = [],$is_json = true)
{
if (empty($header)) {
$header = array(
... ... @@ -78,8 +78,11 @@ if (!function_exists('http_post')) {
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
}
curl_close($ch);
if($is_json){
return json_decode($res, true);
}
return $res;
}
}
... ...
... ... @@ -314,9 +314,15 @@ class LoginController extends BaseController
public function ceshi(){
//同步到大文件
$path = '/upload/m/video/2023-08';
$fileName = '64e81b9b80b13315901.mp4';
$fileName = '64e81b9b80b1331590.mp4';
$file_path = config('filesystems.disks.cos')['cdn1'].$path.'/'.$fileName;
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$path.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
$param = [
'file_path'=>$file_path,
'save_path'=>'/www/wwwroot/cos'.$path
];
$url = 'https://v6-file.globalso.com/upload.php';
http_post($url,$param,['charset=utf-8'],false);
// $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$path.'" https://v6-file.globalso.com/upload.php';
// return shell_exec($cmd);
}
}
... ...