PHP 实现下载文件的方法
2013-07-04 19:38
633 查看
方法一: header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($filepath)); header('Content-Transfer-Encoding: binary'); header('Expires: 0′); header('Cache-Control: must-revalidate, post-check=0, pre-check=0′); header('Pragma: public'); header('Content-Length: ' . filesize($filepath)); readfile($file_path); 方法二: $fileinfo = pathinfo($filename); header('Content-type: application/x-'.$fileinfo['extension']); header('Content-Disposition: attachment; filename='.$fileinfo['basename']); header('Content-Length: '.filesize($filename)); readfile($thefile); exit();
相关文章推荐
- php实现远程网络文件下载到服务器指定目录(方法一)
- 解析PHP实现下载文件的两种方法
- php 下载保存文件保存到本地的两种实现方法
- php做下载文件的实现代码及文件名中乱码解决方法
- php实现简单文件下载的方法
- php简单实现文件或图片强制下载的方法
- PHP实现从远程下载文件的方法
- php 下载保存文件保存到本地的两种实现方法
- php实现图片文件与下载文件防盗链的方法
- php实现图片文件与下载文件防盗链的方法
- PHP实现生成vcf vcard文件功能类定义与使用方法详解【附demo源码下载】[原创]_php技巧_脚本之家
- php实现当前页面点击下载文件的简单方法
- php使用pclzip类实现文件压缩的方法(附pclzip类下载地址)
- PHP 中实现文件下载的几种方法
- php实现远程网络文件下载到服务器指定目录(方法一)
- 解析PHP实现下载文件的两种方法
- 【转】php 下载保存文件保存到本地的两种实现方法
- php 下载保存文件保存到本地的两种实现方法
- php做下载文件的实现代码及文件名中乱码解决方法
- PHP实现打包下载文件的方法示例