加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php 下载保存文件保存到本地的两种实现方法

发布时间:2020-05-28 15:29:08 所属栏目:PHP 来源:互联网
导读:以下是对php下载保存文件保存到本地的两种实现方法进行了介绍,需要的朋友可以过来参考下

第一种:

第二种:

PHP实现下载文件的两种方法。分享下,有用到的朋友看看哦。

方法一:

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);
?>

了解php中header函数的用法。

方法二:

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读