首页 > 应用开发 > IT综合 > PHP中用header来完成下载功能
$sFileName="filename";
$abs_item="filepath"
header("Content-type: application/octetstream");
header('Content-Length: '.filesize($abs_item));
header("Content-Disposition: attachment; filename="".$sFileName.""");
header("Content-Transfer-Encoding: binary");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9812031/viewspace-914530/ ,如需转载,请注明出处,否则将追究法律责任。