• <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 中自动开始下载?

        时间:2023-05-31

        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 中自动开始下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 MySQL 中找不到 outfile 创建的文件 下一篇:是否有相当于 Perl 的 WWW::Mechanize 的 PHP?

                  相关文章

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

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

                      <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>