如何在PHP中隐藏下载管理器的下载链接


How to hide a download link from a download manager in PHP

在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';
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);
?>

MIME类型信息

http://filext.com/file-extension/EXE