久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

      <legend id='rRnHx'><style id='rRnHx'><dir id='rRnHx'><q id='rRnHx'></q></dir></style></legend>

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

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

    1. <tfoot id='rRnHx'></tfoot>
      1. 使用 PHP 下載腳本發送正確的文件大小

        Sending correct file size with PHP download script(使用 PHP 下載腳本發送正確的文件大小)
          <tfoot id='Vo7ez'></tfoot>
        • <small id='Vo7ez'></small><noframes id='Vo7ez'>

          <legend id='Vo7ez'><style id='Vo7ez'><dir id='Vo7ez'><q id='Vo7ez'></q></dir></style></legend>

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

                    <tbody id='Vo7ez'></tbody>
                • 本文介紹了使用 PHP 下載腳本發送正確的文件大小的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我用 PHP 創建了一個文件下載腳本,它可以工作,但網絡瀏覽器將文件報告為未知長度".我的代碼如下:

                  I created a file download script in PHP, it works, but web browsers report the file as "Unknown Length". My code is as follows:

                  function downloadFile($file){
                    // Set up the download system...
                    header('Content-Description: File Transfer');
                    header('Content-Type: '.mime_content_type($file));
                    header('Content-Disposition: attachment; filename="'.basename($file).'"');
                    header('Content-Transfer-Encoding: binary');
                    header('Expires: 0');
                    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                    header('Pragma: public');
                    header('Content-Length: '.filesize($file));
                  
                    // Flush the cache
                    ob_clean();
                    flush();
                  
                    // Send file to browser
                    readfile($file);
                  
                    // DO NOT DO ANYTHING AFTER FILE DOWNLOAD
                    exit;
                  }
                  

                  推薦答案

                  原文來自 http://paul.luminos.nl/update/471:

                  CrimsonBase 網站通過一個強大的 PHP 腳本來驗證下載,類似于 Andrew Johnson 發布的腳本在 他關于 PHP 控制的文件下載的文章中.

                  The CrimsonBase website verifies downloads by passing them through a robust PHP script similar to the one published by Andrew Johnson in his article about PHP-controlled file downloads.

                  Andrew 在文章末尾發表了一個非常重要的評論:

                  Andrew makes a very important comment at the end of the article:

                  "如果您使用 Zlib、mod_deflate 等壓縮文件,則 Content-Length 標頭將不準確,因此您最終會看到未知大小"和剩余時間未知"下載文件時."

                  "If you compress files with Zlib, mod_deflate and so on the Content-Length header won't be accurate so you'll end up seeing "Unknown size" and "Unknown time remaining" when downloading files."

                  我想強調一點:如果您的瀏覽器似乎沒有遵守由您的 PHP 腳本生成的標頭——尤其是 Content-Length——很可能是 Apache 的 mod_deflate 擴展已啟用.

                  I would like to stress this: if your browser doesn't appear to be obeying the headers generated by your PHP script—especially Content-Length—it is fairly likely that Apache's mod_deflate extension is enabled.

                  您可以使用適用的 .htaccess 文件中的以下行輕松為單個腳本禁用它:

                  You can easily disable it for a single script using the following line in an applicable .htaccess file:

                  SetEnvIfNoCase Request_URI ^/download.php no-gzip dont-vary
                  

                  此處假定 download.php 位于服務器根目錄路徑中的下載腳本中(例如 www.crimsonbase.com/download.php).(那是因為正則表達式是^/download.php.)

                  where download.php is here assumed to be in the download script located in the server's root directory path (e.g. www.crimsonbase.com/download.php). (That's because the regular expression is ^/download.php.)

                  這篇關于使用 PHP 下載腳本發送正確的文件大小的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  • <bdo id='YUHnb'></bdo><ul id='YUHnb'></ul>

                    1. <legend id='YUHnb'><style id='YUHnb'><dir id='YUHnb'><q id='YUHnb'></q></dir></style></legend>
                        <tbody id='YUHnb'></tbody>

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

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

                            <i id='YUHnb'><tr id='YUHnb'><dt id='YUHnb'><q id='YUHnb'><span id='YUHnb'><b id='YUHnb'><form id='YUHnb'><ins id='YUHnb'></ins><ul id='YUHnb'></ul><sub id='YUHnb'></sub></form><legend id='YUHnb'></legend><bdo id='YUHnb'><pre id='YUHnb'><center id='YUHnb'></center></pre></bdo></b><th id='YUHnb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='YUHnb'><tfoot id='YUHnb'></tfoot><dl id='YUHnb'><fieldset id='YUHnb'></fieldset></dl></div>
                            主站蜘蛛池模板: 欧美精品在线免费 | 国产精品一区二区日韩 | 成人午夜免费福利视频 | 国产91丝袜在线播放 | 美女黄18岁以下禁止观看 | 久久久免费 | 国产大毛片| 精品日韩一区 | 女人毛片a毛片久久人人 | 成人免费一区二区 | 国产.com| 色综合久久久 | 欧美日韩精品久久久免费观看 | 欧美激情一区二区三级高清视频 | 亚洲精品一二三区 | 国产精品99久久久久 | av午夜电影 | 国产视频1区2区 | 久久高清| av在线播放网站 | 久久人体视频 | 国产精品99久久久久久久久 | 国产免费一区二区三区最新6 | 国产日韩欧美一区二区在线播放 | 午夜久久av | 黄色片在线看 | 在线精品一区二区三区 | 日本成人午夜影院 | 亚洲欧美在线观看视频 | 精品久| 日韩国产精品一区二区三区 | 欧美国产精品一区二区三区 | 精品乱码一区二区 | 手机av在线 | 欧美日韩精品免费观看 | 激情视频中文字幕 | 欧区一欧区二欧区三免费 | 国产一级视频在线播放 | 老外几下就让我高潮了 | 久久夜视频 | 男女视频在线观看 |