ITPub博客

首页 > 应用开发 > IT综合 > PHP中用header来完成下载功能

PHP中用header来完成下载功能

原创 IT综合 作者:mokai2080 时间:2007-05-11 16:25:39 0 删除 编辑

$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");

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9812031/viewspace-914530/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    11
  • 访问量
    25110