php下载大文件
2016-07-21 11:10
633 查看
<?php $file = @ fopen($file_dir . $file_name,"r"); $filesize=filesize($file_dir.$file_name); header('Content-Description:File Transfer'); header("Content-Type:application/octet-stream"); header('Content-Transfer-Encoding:binary'); header("Accept-Ranges: bytes"); header('Expires:0'); header('Cache-Control:must-revalidate'); header('Pragma:public'); header("Content-Length:".$filesize); header("Content-Disposition:attachment;filename=".$file_name); ob_start(); fseek($file,0); while (!feof($file)) { set_time_limit(0); print (fread($file, 1024 * 8)); ob_flush(); flush(); } fclose($file);
相关文章推荐
- php中preg_replace_callback函数简单用法示例
- [php]对象遍历
- php 获取服务器IP
- 简单快速打造你自己的PHP MVC框架
- PHP error_reporting
- PHP加速器eAccelerator安装
- php写守护进程(Daemon)
- matplot设置xy轴范围
- UDP RTP 丢包 解决方案AVCom模块API接口使用说明
- PHP获取客户端及服务器端IP的封装类
- Yii2 防止用户重复登录
- php 文件操作
- Zend Studio使用教程之集成Apigility(二)
- laravel 初见 安装 路由 模块化 2016.07.20回顾
- Thinkphp的参数过滤函数
- php永久登录 记住密码
- [李景山php]thinkphp核心源码注释|Sqlsrv.class.php
- [李景山php]thinkphp核心源码注释|Sqlite.class.php
- [李景山php]thinkphp核心源码注释|Pgsql.class.php
- PHP图片上传程序(完整版)