• <bdo id='S2go9'></bdo><ul id='S2go9'></ul>
  1. <small id='S2go9'></small><noframes id='S2go9'>

    <tfoot id='S2go9'></tfoot>
  2. <i id='S2go9'><tr id='S2go9'><dt id='S2go9'><q id='S2go9'><span id='S2go9'><b id='S2go9'><form id='S2go9'><ins id='S2go9'></ins><ul id='S2go9'></ul><sub id='S2go9'></sub></form><legend id='S2go9'></legend><bdo id='S2go9'><pre id='S2go9'><center id='S2go9'></center></pre></bdo></b><th id='S2go9'></th></span></q></dt></tr></i><div id='S2go9'><tfoot id='S2go9'></tfoot><dl id='S2go9'><fieldset id='S2go9'></fieldset></dl></div>
    1. <legend id='S2go9'><style id='S2go9'><dir id='S2go9'><q id='S2go9'></q></dir></style></legend>

      一个让用户从我的网站下载文件而不泄露我网站中实际文件链接的 PHP 脚本?

      A PHP script to let users download a file from my website without revealing the actual file link in my website?(一个让用户从我的网站下载文件而不泄露我网站中实际文件链接的 PHP 脚本?)
      • <bdo id='nD4Ry'></bdo><ul id='nD4Ry'></ul>
      • <small id='nD4Ry'></small><noframes id='nD4Ry'>

          <tbody id='nD4Ry'></tbody>
        <i id='nD4Ry'><tr id='nD4Ry'><dt id='nD4Ry'><q id='nD4Ry'><span id='nD4Ry'><b id='nD4Ry'><form id='nD4Ry'><ins id='nD4Ry'></ins><ul id='nD4Ry'></ul><sub id='nD4Ry'></sub></form><legend id='nD4Ry'></legend><bdo id='nD4Ry'><pre id='nD4Ry'><center id='nD4Ry'></center></pre></bdo></b><th id='nD4Ry'></th></span></q></dt></tr></i><div id='nD4Ry'><tfoot id='nD4Ry'></tfoot><dl id='nD4Ry'><fieldset id='nD4Ry'></fieldset></dl></div>

                <legend id='nD4Ry'><style id='nD4Ry'><dir id='nD4Ry'><q id='nD4Ry'></q></dir></style></legend><tfoot id='nD4Ry'></tfoot>
                本文介绍了一个让用户从我的网站下载文件而不泄露我网站中实际文件链接的 PHP 脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                问题说明了一切.. 我如何让用户从我的网站下载文件而不是让他们看到该文件来自哪个链接?我知道可能需要像 download.php 这样的东西作为网关,但是过了那个阶段,我不知道接下来要编写什么脚本......代码,我应该需要使用的几个函数名称真的很方便!

                The question says it all.. How do I let the users download a file from my website and not let them see what link that file comes from? I understand that there might be a need for something like a download.php which will serve as the gateway but past that phase, I dunno what to script next... If it bothers you to write the whole code, a few function names that I should need to use would be really handy!

                推荐答案

                找到一种方法来识别要下载的文件(例如,与数据库中某行的 ID 匹配的 GET 变量,或类似的东西).确保它是有效的,因为您不希望您的用户能够从您的站点下载任何内容.然后,使用 headerContent-Disposition 告诉浏览器应该下载文件,readfile 输出它.

                Find a way to identify the file to download (for instance, a GET variable that matches the ID of a row in a database, or something along these lines). Make damn sure it's a valid one, because you don't want your users to be able to download anything off your site. Then, use header with Content-Disposition to tell the browser the file should be downloaded, and readfile to output it.

                例如:

                <?php
                
                $id = intval($_GET['id']);
                $query = mysql_query('SELECT file_path FROM files WHERE id = ' . $id);
                if (($row = mysql_fetch_row($query)) !== false)
                {
                    header('Content-Disposition: attachment; filename=' . basename($row[0]));
                    readfile($row[0]);
                }
                exit;
                
                ?>
                

                这篇关于一个让用户从我的网站下载文件而不泄露我网站中实际文件链接的 PHP 脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
              • <legend id='R0GEX'><style id='R0GEX'><dir id='R0GEX'><q id='R0GEX'></q></dir></style></legend>

                  <tbody id='R0GEX'></tbody>

                <tfoot id='R0GEX'></tfoot>
                • <bdo id='R0GEX'></bdo><ul id='R0GEX'></ul>
                      <i id='R0GEX'><tr id='R0GEX'><dt id='R0GEX'><q id='R0GEX'><span id='R0GEX'><b id='R0GEX'><form id='R0GEX'><ins id='R0GEX'></ins><ul id='R0GEX'></ul><sub id='R0GEX'></sub></form><legend id='R0GEX'></legend><bdo id='R0GEX'><pre id='R0GEX'><center id='R0GEX'></center></pre></bdo></b><th id='R0GEX'></th></span></q></dt></tr></i><div id='R0GEX'><tfoot id='R0GEX'></tfoot><dl id='R0GEX'><fieldset id='R0GEX'></fieldset></dl></div>

                        1. <small id='R0GEX'></small><noframes id='R0GEX'>