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

Original 2017-02-04 10:51:06 336
abstract:本文实例讲述了php隐藏实际地址的文件下载方法。分享给大家供大家参考。具体如下:下面这段php代码可不透露实际的文件下载地址。function download_document($filename,$path="",$mimetype="application/octet-stream") { header("Cache-C

本文实例讲述了php隐藏实际地址的文件下载方法。分享给大家供大家参考。具体如下:

下面这段php代码可不透露实际的文件下载地址。

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中文网(m.sbmmt.com)其他文章!


Release Notes

Popular Entries