我是靠谱客的博主 坚定哈密瓜,这篇文章主要介绍php文件解析器 下载,解析PHP实现下载文件的两种方法,现在分享给大家,希望可以做个参考。

方法一:

复制代码 代码如下:

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文件解析器内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(42)

评论列表共有 0 条评论

立即
投稿
返回
顶部