<legend id='9avjz'><style id='9avjz'><dir id='9avjz'><q id='9avjz'></q></dir></style></legend>
    <bdo id='9avjz'></bdo><ul id='9avjz'></ul>
  • <tfoot id='9avjz'></tfoot>

      <small id='9avjz'></small><noframes id='9avjz'>

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

      1. PHP - 保护数字下载

        PHP - Protecting digital Downloads(PHP - 保护数字下载)
        <tfoot id='qRvQ9'></tfoot>

        <small id='qRvQ9'></small><noframes id='qRvQ9'>

            • <bdo id='qRvQ9'></bdo><ul id='qRvQ9'></ul>

              <legend id='qRvQ9'><style id='qRvQ9'><dir id='qRvQ9'><q id='qRvQ9'></q></dir></style></legend>
              <i id='qRvQ9'><tr id='qRvQ9'><dt id='qRvQ9'><q id='qRvQ9'><span id='qRvQ9'><b id='qRvQ9'><form id='qRvQ9'><ins id='qRvQ9'></ins><ul id='qRvQ9'></ul><sub id='qRvQ9'></sub></form><legend id='qRvQ9'></legend><bdo id='qRvQ9'><pre id='qRvQ9'><center id='qRvQ9'></center></pre></bdo></b><th id='qRvQ9'></th></span></q></dt></tr></i><div id='qRvQ9'><tfoot id='qRvQ9'></tfoot><dl id='qRvQ9'><fieldset id='qRvQ9'></fieldset></dl></div>
                    <tbody id='qRvQ9'></tbody>
                  本文介绍了PHP - 保护数字下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在研究如何保护 PHP 中的数字下载.只需要一些大致的方向,这样我就可以开始我的研究.我似乎找不到任何有用的东西.

                  I'm trying figure out how I can protect digital downloads in PHP. Just need some general directions so I can start my research. I don't seem to be able to find anything useful.

                  我想让我的用户可以下载文件,但不希望他们能够直接访问下载文件夹.另外,我希望下载链接只能在设定的时间段内或单次下载内使用.

                  I want to make files available for my users to download but don't want them to be able to directly access a download folder. Also, I want the download link to be available only for set period of time or a single download.

                  有人能指出我正确的方向吗?

                  Could some one point me in the right direction?

                  推荐答案

                  最好的方法是在您检查后将下载管理委托给 apache 的 mod

                  The best way is to delegate the download managment after your check to the mod for apache

                  x_sendfile
                  

                  https://tn123.org/mod_xsendfile/

                  用法:

                  <?php
                  ...
                  if ($user->isLoggedIn())
                  {
                      header("X-Sendfile: $path_to_somefile");
                      header("Content-Type: application/octet-stream");
                      header("Content-Disposition: attachment; filename="$somefile"");
                      exit;
                  }
                  ?>
                  <h1>Permission denied</h1>
                  <p>Login first!</p>
                  

                  基本上,当您发送标头 X-Sendfile 时,mod 会拦截该文件并为您管理下载(该文件可以随时位于虚拟主机之外).

                  Basically when you send the header X-Sendfile the mod intercepts the file and manages the download for you (the file can be located whenever you want outside the virtualhost).

                  否则你可以只实现一个简单的文件download.php,它获取文件的id并在登录检查后用readfile打印内容

                  Otherwise you can just implement a simple file download.php that gets the id of the file and prints the contents with readfile after the login check

                  这篇关于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 的问题)
                • <i id='W8P49'><tr id='W8P49'><dt id='W8P49'><q id='W8P49'><span id='W8P49'><b id='W8P49'><form id='W8P49'><ins id='W8P49'></ins><ul id='W8P49'></ul><sub id='W8P49'></sub></form><legend id='W8P49'></legend><bdo id='W8P49'><pre id='W8P49'><center id='W8P49'></center></pre></bdo></b><th id='W8P49'></th></span></q></dt></tr></i><div id='W8P49'><tfoot id='W8P49'></tfoot><dl id='W8P49'><fieldset id='W8P49'></fieldset></dl></div>

                    <tfoot id='W8P49'></tfoot>

                      <small id='W8P49'></small><noframes id='W8P49'>

                        <bdo id='W8P49'></bdo><ul id='W8P49'></ul>
                        1. <legend id='W8P49'><style id='W8P49'><dir id='W8P49'><q id='W8P49'></q></dir></style></legend>

                            <tbody id='W8P49'></tbody>