php文件下载函数
2015-10-05 23:10
666 查看
<?php /** *Fil_download *$path 要下载的文件路径 *$type 要下载的文件类型 */ function Fil_download($path,$type = 'zip') { if(!file_exists($path)) { return false; }else{ $file = fopen($path,'r'); header('Content-Type: application/'.$type); header('Content-disposition: attachment; filename='.basename($path)); header('Content-Length: '.filesize($path)); echo fread($file,filesize($file_dir)); fclose( $file ); exit (); } } ?>
相关文章推荐
- thinkphp-关于后台加入权限检测后,后台登陆验证码的引入
- PHP开发经验中介(thinkphp3.2使用技巧)
- Thinkphp 加载类库import()方法
- symfony权威指南(4、1)之动作
- ThinkPHP增删改查小例子
- PHP命名空间(Namespace)的使用详解
- PHP 基于mysqli面向过程的数据库插入实例
- YII框架的模块化技术
- 用thinkPHP实现验证码的功能
- php mysql_real_escape_string() 函数
- php get_magic_quotes_gpc()函数
- editplus查找替换的正则表达式应用
- php addslashes()函数
- 从Azure虚拟机下载文件到本地五种方法
- php正则表达式匹配img中任意属性的方法
- laravel paginate动态分页
- thinkphp中Conf的配置
- 使用PHP实现文件上传
- php对图片上传的处理
- PHP随笔