网站制作学习网经验与学习→正文:application/force-download
字体:

application/force-download

经验与学习 2010/7/27 9:39:04  点击:不统计

转载%77%77%77请%2E%66%6F%72%61%73%70%2E%63%6E注明
做php下载代码时用到的,php强制下载application/force-download,将发送HTTP 标头您的浏览器并告诉它下载,而不是在浏览器中运行的文件
$content_url//下载文件地址,可以是网络地址,也可以是本地物理路径或者虚拟路径
ob_end_clean(); //函数ob_end_clean 会清除缓冲区的内容,并将缓冲区关闭,但不会输出内容。
header("Content-Type: application/force-download;"); //告诉浏览器强制下载
header("Content-Transfer-Encoding: binary");
header("Content-Length: $taille");
header("Content-Disposition: attachment; filename=\"下载后的名字以及后缀\");
header("Expires: 0");
header("Cache-control: private");
header("Pragma: no-cache"); //不缓存页面
readfile($content_url);
原载于:本文原载于www.forasp.cn

·上一篇:CFM文件 >>    ·下一篇:sqlserver时间格式转换 >>
推荐文章
最新文章