php

推荐列表 站点导航

当前位置:首页 > 脚本编程 > php >

php隐藏实际地址的文件下载方法

来源:互联网  作者:网友投稿  发布时间:2021-01-11 12:59
这篇文章主要介绍了php隐藏实际地址的文件下载方法,涉及php中header与file_get_contents方法的相关使用技巧,非常具有实用...

下面这段php代码可不透露实际的文件下载地址, pre-check=0); header(Content-Disposition: attachment; filename = $filename); header(Content-Length: . filesize($pathto . $filename)); header(Content-Type: $mimetype); echo file_get_contents($pathto . $filename); } 实现方法二: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ?php $file = 1.txt;// 文件的真实地址(支持url,$path=,不过不建议用url) if (file_exists($file)) { header(Content-Description: File Transfer); header(Content-Type: application/octet-stream); header(Content-Disposition: attachment; filename=.basename($file)); header(Content-Transfer-Encoding: binary); header(Expires: 0); header(Cache-Control: must-revalidate, pre-check=0); header(Pragma: public); header(Content-Length: . filesize($file)); ob_clean(); flush(); readfile($file); exit; } ? , post-check=0, ? 1 2 3 4 5 6 7 8 function download_document($filename,$mimetype=application/octet-stream) { header(Cache-Control: must-revalidate, post-check=0,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://www.juheyunku.com/jiaob/php/12356.shtml

最新文章
护卫神php套件 php版本升级 护卫神php套件 php版本升级

时间:2021-01-10

浅析iis7.5安装配置php环境 浅析iis7.5安装配置php环境

时间:2021-01-10

PHP异常处理浅析 PHP异常处理浅析

时间:2021-01-06

PHP嵌套输出缓冲代码实例 PHP嵌套输出缓冲代码实例

时间:2021-01-06

PHP的伪随机数与真随机数 PHP的伪随机数与真随机数

时间:2021-01-04

php实现的日历程序 php实现的日历程序

时间:2020-12-29

PHP实现链式操作的核心思 PHP实现链式操作的核心思

时间:2020-12-29

PHP中把错误日志保存在系 PHP中把错误日志保存在系

时间:2020-12-29

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

php隐藏实际地址的文件下载方法

2021-01-11 编辑:网友投稿

下面这段php代码可不透露实际的文件下载地址, pre-check=0); header(Content-Disposition: attachment; filename = $filename); header(Content-Length: . filesize($pathto . $filename)); header(Content-Type: $mimetype); echo file_get_contents($pathto . $filename); } 实现方法二: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ?php $file = 1.txt;// 文件的真实地址(支持url,$path=,不过不建议用url) if (file_exists($file)) { header(Content-Description: File Transfer); header(Content-Type: application/octet-stream); header(Content-Disposition: attachment; filename=.basename($file)); header(Content-Transfer-Encoding: binary); header(Expires: 0); header(Cache-Control: must-revalidate, pre-check=0); header(Pragma: public); header(Content-Length: . filesize($file)); ob_clean(); flush(); readfile($file); exit; } ? , post-check=0, ? 1 2 3 4 5 6 7 8 function download_document($filename,$mimetype=application/octet-stream) { header(Cache-Control: must-revalidate, post-check=0,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://www.juheyunku.com/jiaob/php/12356.shtml

相关文章

风云图片

推荐阅读

返回php频道首页