php下载文件
来源:互联网 发布:批量网页录入数据 编辑:程序博客网 时间:2024/06/05 06:29
页面
$url = 'index.php?r=site/download&fn='.json_encode($filename.'.xls'); echo "<iframe src='$url' style='display:none'></iframe>";
方法
public function Download() { $filedir = 'cache/'; $fn = json_decode($_GET['fn']); $filename = iconv('utf-8','gbk',$fn); if (!file_exists($filedir.$filename)){ header("Content-type: text/html; charset=utf-8"); echo "File not found!"; exit; } else { $file = fopen($filedir.$filename,"r"); header("Content-type: application/force-download"); header("Accept-Ranges: bytes"); header("Accept-Length: ".filesize($filedir.$filename)); header("Content-Disposition: attachment; filename=".$filename); echo fread($file, filesize($filedir.$filename)); fclose($file); } }
- PHP实现文件下载
- PHP实现文件下载
- PHP实现文件下载
- php 文件下载类
- php自动下载文件
- php下载文件代码
- PHP实现文件下载
- 关于PHP文件下载
- PHP强制性文件下载
- php 下载文件代码
- PHP下载文件
- php下载文件
- php强制下载文件
- php下载文件
- php下载文件
- php下载文件方法
- php下载文件
- PHP下载文件代码
- innodb中的REDO解析
- ※※Java调用Runtime.exec()要注意的问题
- yii --memcached缓存的配置
- 配置PHP+mssql环境的一些常见问题及解决方案
- 制作分享按钮
- php下载文件
- 从UIView的子类中推入视图控制器
- linux C经典面试题五
- PHP分页函数 自己收藏只用【上一页】123456【 下一页】
- properties 文件操作
- 什么是native compiler?什么是cross compiler?
- 中国最美的40个旅游景点
- string时间处理的很好
- VS2010 简单ATL COM开发(上)