//下载附件,file 为附件地址
public function actionDownload(){
if(!fopen('http://'.$_GET['file'],'r')){
die('图片不存在');
}
$filename = 'http://'.$_GET['file'];//图片地址,可以绝对地址也可以相对地址
header("Content-Type: application/force-download");
header('Content-Disposition: attachment; filename="'.$filename.'"');
$img = file_get_contents($filename);
echo $img;
}
public function actionDownload(){
if(!fopen('http://'.$_GET['file'],'r')){
die('图片不存在');
}
$filename = 'http://'.$_GET['file'];//图片地址,可以绝对地址也可以相对地址
header("Content-Type: application/force-download");
header('Content-Disposition: attachment; filename="'.$filename.'"');
$img = file_get_contents($filename);
echo $img;
}