PHP 文件下载 兼容ie8,ie7,google chrome
来源:互联网 发布:mysql linux 64 下载 编辑:程序博客网 时间:2024/05/26 19:18
header('Cache-Control: private, must-revalidate,post-check=0, pre-check=0, max-age=1');//这句兼容低版本ie
//header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Type: image/gif');
// use the Content-Disposition header to supply a recommended filename
header('Content-Disposition: attachment; filename='.$saveFileName);
header('Content-Transfer-Encoding: binary');
echo file_get_contents($file);
exit;
-----------------------------------------------------------------------------------大文件下载存在问题,修改成下面的下载方式--------------------------------------
$path =‘data/test.exe’;
$mm_type="application/octet-stream"; // modify accordingly to the file type of $path, but in most cases no need to do so
$filesize = filesize($path);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: " . $mm_type);
header("Content-Length: " .$filesize );
header('Content-Disposition: attachment; filename="'.basename($path).'"');
header("Content-Transfer-Encoding: binary\n");
$chunksize = 1 * (1024 * 1024); // how many bytes per chunk
if ($filesize > $chunksize) {
$handle = fopen($path, 'rb');
$buffer = '';
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
echo $buffer;
ob_flush();
flush();
}
fclose($handle);
} else {
readfile($path);
}
//readfile($path); // outputs the content of the file
exit();
- PHP 文件下载 兼容ie8,ie7,google chrome
- 浏览器兼容:IE6,IE7,IE8,FIREFOX,Chrome
- 浏览器兼容:IE6,IE7,IE8,FIREFOX,Chrome
- 收藏兼容ie6 ie7 ie8 ff Chrome 屏蔽鼠标右键
- iframe自适应高度(兼容IE6、IE7、IE8、fireFox、Chrome)
- 关于Javascript关闭网页兼容IE6,IE7,IE8,FF,Chrome
- margin如何在FF/IE6/IE7/IE8/Google兼容浏览器
- ie8兼容IE7问题
- Ie8兼容ie7
- 兼容IE6 IE7 IE8
- IE8兼容IE7
- 让IE8兼容IE7
- IE8兼容IE7
- bootstrap兼容IE8,IE7
- IE8中实现垂直居中(兼容IE6、IE7、IE8,Firefox,Chrome等)
- IE8兼容IE7的方法
- 兼容 FF, IE6 ,IE7,IE8
- 兼容 FF, IE6 ,IE7,IE8
- PHP session使用经验汇总
- 4.9 基于OHCI的USB主机 —— USB设备获取描述符通用函数
- zoj 3261 - Connections in Galaxy War(并查集)
- Session深度解析
- UML四中关系浅解析
- PHP 文件下载 兼容ie8,ie7,google chrome
- PHP Session有效期的相关问题
- 4.10 基于OHCI的USB主机 —— USB设备取得设备描述符
- POJ 2096 Collecting Bugs 概率 + markov链原理
- 基于Log4j灵活编写日志类
- sublime text 2 开启 vim 模式
- 4.11 基于OHCI的USB主机 —— USB设备去的配置描述符
- 快速记忆英语单词的妙招
- Apache+tomcat的整合