如何在PHP中从下载管理器隐藏下载链接
在PHP中,我们可以执行以下操作如何在PHP中从下载管理器隐藏下载链接,php,url,download,Php,Url,Download,在PHP中,我们可以执行以下操作 <?php header("Location: https://www.example.com/test.exe"); ?> 下载一个文件。但是,URL将在下载管理器(如DAP)中可见。那么,真的有办法完全隐藏下载URL吗?//这将对您有所帮助 //This will help you <?php $fullpath = 'https://www.example.com/test.exe'; $filename ='test.exe'
<?php
header("Location: https://www.example.com/test.exe");
?>
下载一个文件。但是,URL将在下载管理器(如DAP)中可见。那么,真的有办法完全隐藏下载URL吗?//这将对您有所帮助
//This will help you
<?php
$fullpath = 'https://www.example.com/test.exe';
$filename ='test.exe';
header("Cache-Control: public, must-revalidate");
header("Content-Type: application/exe");
header("Content-Length: " .(string)(filesize($fullpath)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
readfile($fullpath);
?>
生成一个随机字符串,与数据库建立链接(字符串->计算机上的文件),当用户请求一个文件时,链接被生成,然后当它被使用时,链接被删除。我在我的Chrome浏览器中尝试了它。弹出一条错误消息:“从服务器接收到重复的头”。