您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

解析PHP实现下载文件的两种方法_PHP教程

2024/4/7 6:31:29发布101次查看
方法一:
复制代码 代码如下:
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();
http://www.bkjia.com/phpjc/328007.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/328007.htmltecharticle方法一: 复制代码 代码如下: header('content-description: file transfer'); header('content-type: application/octet-stream'); header('content-disposition: attachment; fil...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product