• <tfoot id='LCqbp'></tfoot>

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

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

          <bdo id='LCqbp'></bdo><ul id='LCqbp'></ul>
      2. 如何在 PHP 中自动开始下载?

        How to Automatically Start a Download in PHP?(如何在 PHP 中自动开始下载?)

        1. <tfoot id='nGUjc'></tfoot>
              <bdo id='nGUjc'></bdo><ul id='nGUjc'></ul>

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

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

                  问题描述

                  需要在 PHP 中添加什么代码才能在访问链接时自动让浏览器将文件下载到本地机器?

                  What code do you need to add in PHP to automatically have the browser download a file to the local machine when a link is visited?

                  我特别想到了类似于下载站点的功能,一旦您单击软件名称,就会提示用户将文件保存到磁盘?

                  I am specifically thinking of functionality similar to that of download sites that prompt the user to save a file to disk once you click on the name of the software?

                  推荐答案

                  在输出文件前发送以下标题:

                  Send the following headers before outputting the file:

                  header("Content-Disposition: attachment; filename="" . basename($File) . """);
                  header("Content-Type: application/octet-stream");
                  header("Content-Length: " . filesize($File));
                  header("Connection: close");
                  

                  @grom:关于application/octet-stream"MIME 类型很有趣.我不知道,一直只使用应用程序/强制下载":)

                  @grom: Interesting about the 'application/octet-stream' MIME type. I wasn't aware of that, have always just used 'application/force-download' :)

                  这篇关于如何在 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 的问题)

                • <small id='nvDFO'></small><noframes id='nvDFO'>

                • <legend id='nvDFO'><style id='nvDFO'><dir id='nvDFO'><q id='nvDFO'></q></dir></style></legend>
                    <tbody id='nvDFO'></tbody>

                      <bdo id='nvDFO'></bdo><ul id='nvDFO'></ul>

                          1. <tfoot id='nvDFO'></tfoot>

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