dongtao5055 2013-07-26 06:40
浏览 34

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

In PHP, we can do something like

<?php
 header("Location: https://www.example.com/test.exe");
?>

to download a file. However, the URL will be visible in a download manager such as DAP. So is there really a way to hide the download URL altogether?

  • 写回答

1条回答 默认 最新

  • dth34653 2013-07-26 06:47
    关注
    //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 type informations

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

    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决