温馨提示×

如何将linux服务器下的图片放到cdn

九三
228
2021-02-12 19:48:04
栏目: 云计算

如何将linux服务器下的图片放到cdn

Linux系统通过配置form.api文件属性将图片放到cdn

1.在Linux系统中,打开form.api文件;

[root@centosGuli bin]# vi form.api

2.form.api文件打开后,在文件写入配置即可;

function upload_cdn($file_path) {

if (class_exists('\CURLFile')) {// 这里用特性检测判断php版本

$file_path = new \CURLFile(realpath($file_path));//>=5.5

} else {

$file_path = '@'.$file_path;//<=5.5

}

$url = "服务器地址";

$data = array(

'imgfile1'=>$file_path,

'PHPSESSID'=>'ba4d1587aab023fd8cfa28fbe36c8235',

'totalform'=>'1'

);

$result = doPost2($url,$data);

return $result;

}

0