用php header() 实现文件下载

$file = fopen(’文件链接地址‘,”r”);
@Header(“Content-type: application/octet-stream”);
@Header(“Accept-Ranges: bytes”);
@Header(“Accept-Length: “.filesize(’文件链接地址‘));
@Header(“Content-Disposition: attachment; filename=” .basename(’文件链接地址‘));
echo fread($file,filesize(’文件链接地址‘));
fclose($file);

点赞