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;
}
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: 网站服务器被恶意攻击如何解决