成都创新互联网站制作重庆分公司

php如何隐藏实际文件下载地址

php隐藏实际文件下载地址的方法:使用header与【file_get_contents】方法,代码为【header("Content-Type: $mimetype");echo file_get_contents($pathto)】。

临澧网站制作公司哪家好,找创新互联建站!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联建站从2013年开始到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联建站

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

涉及php中header与file_get_contents方法的相关使用技巧,非常具有实用价值,需要的朋友可以参考下:

实现方法一:

function download_document($filename,$path="",$mimetype="application/octet-stream")
{
 header("Cache-Control: must-revalidate, post-check=0, 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);
}

实现方法二:

想了解更多编程学习,敬请关注php培训栏目!


本文题目:php如何隐藏实际文件下载地址
网站URL:http://cxhlcq.com/article/chdedj.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部