PHP实现文件下载
2016-06-22 19:21
453 查看
public function get_download_file() { header ( 'Content-Description: File Transfer' ); header ( 'Content-Type: application/octet-stream' ); header ( 'Content-Disposition: attachment; filename=' . basename ( $file )); header ( 'Content-Transfer-Encoding: binary' ); header ( 'Expires: 0' ); header ( 'Cache-Control: must-revalidate' ); header ( 'Pragma: public' ); header ( 'Content-Length: ' . filesize ( $file )); ob_clean (); flush (); readfile ( $file ); exit; }
相关文章推荐
- YII 框架学习[1] —— 引入Yii框架
- laravel5.2.36 Request验证类错误输出不显示问题
- thinkphp 笔记
- cookie中文乱码解决(php/js)
- 使用php脚本查看已开启的扩展
- PHP 时间函数
- Yii 一些小的问题
- php文件上传
- PHP中in_array 效率优化
- php导出CSV时,超长数字精度丢失问题与前导0的字符串丢失0的问题解决
- 安装ftp服务器vsftp
- php header 设置文件下载
- PHP中$_FILES的使用方法及注意事项说明
- php5权限控制修饰符
- php5.6.21编译安装
- PHP服务器配置环境变量
- yii框架原生代码
- FTP命令
- PHP_EOL
- 无废话 Thrift 之 Hello World( PHP 版).