设为首页 - 加入收藏 - 网站地图 欢迎加QQ群 :14364084
当前位置:谭博的博客 > 编程语言 > php > 正文

php通过header的实现下载功能

时间:2013-03-03 18:16 来源: 标签: 作者:谭博 阅读:
header(“Pragma: public”);
header(“Expires: 0″);
header(“Cache-Control:must-revalidate, post-check=0, pre-check=0″);
header(“Content-Type:application/force-download”);
header(“Content-Type:application/vnd.ms-execl”);
header(“Content-Type:application/octet-stream”);
header(“Content-Type:application/download”);
header(“Content-Disposition:attachment;filename=’{$filename}’”);
header(“Content-Transfer-Encoding:binary”);

 

echo file_get_content($filename);

 

 

关注微信公众号

微信扫一扫,打赏我