欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php隐藏实际地址的文件下载方法,_PHP教程

程序员文章站 2024-02-08 20:06:10
...

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

本文实例讲述了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程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/986072.htmlTechArticlephp隐藏实际地址的文件下载方法, 本文实例讲述了php隐藏实际地址的文件下载方法。分享给大家供大家参考。具体如下: 下面这段php代码...
相关标签: php 文件下载