给你个代码$file = 'monkey.gif';//文件名if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');//打开方式
header('Content-Disposition: attachment; filename='.basename($file));//设定保存文件名
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));//文件尺寸
ob_clean();
flush();
readfile($file);//读取实际文件
exit;
}
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');//打开方式
header('Content-Disposition: attachment; filename='.basename($file));//设定保存文件名
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));//文件尺寸
ob_clean();
flush();
readfile($file);//读取实际文件
exit;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货