<tfoot id='eLkDs'></tfoot>

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

    1. <i id='eLkDs'><tr id='eLkDs'><dt id='eLkDs'><q id='eLkDs'><span id='eLkDs'><b id='eLkDs'><form id='eLkDs'><ins id='eLkDs'></ins><ul id='eLkDs'></ul><sub id='eLkDs'></sub></form><legend id='eLkDs'></legend><bdo id='eLkDs'><pre id='eLkDs'><center id='eLkDs'></center></pre></bdo></b><th id='eLkDs'></th></span></q></dt></tr></i><div id='eLkDs'><tfoot id='eLkDs'></tfoot><dl id='eLkDs'><fieldset id='eLkDs'></fieldset></dl></div>
      <legend id='eLkDs'><style id='eLkDs'><dir id='eLkDs'><q id='eLkDs'></q></dir></style></legend>
        <bdo id='eLkDs'></bdo><ul id='eLkDs'></ul>
      1. 用于下载文件的 PHP 脚本在 IE 中不起作用

        时间:2024-08-22

                <tbody id='LRx5r'></tbody>
              <legend id='LRx5r'><style id='LRx5r'><dir id='LRx5r'><q id='LRx5r'></q></dir></style></legend>
                <bdo id='LRx5r'></bdo><ul id='LRx5r'></ul>

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

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

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

                  本文介绍了用于下载文件的 PHP 脚本在 IE 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个脚本,它从 $_GET['key'] 获取密钥,在数据库中查找位置,并使用 readfile 和一些标题来提供下载以供使用.这适用于 Firefox 但不适用于 IE8,无法在另一个 IE 上进行测试.我在 IE 中收到以下错误:Internet Explorer 无法从 www.example.com 下载 download.php".好像它正在尝试下载 PHP 脚本.

                  I have a script that takes a key from $_GET['key'] , looks up the location in a database and uses the readfile together with some headers to present a download for the use. This works in Firefox but not IE8, haven't been able to test it on another IE. I get the following error in IE: "Internet Explorer cannot download download.php from www.example.com". As if it is trying to download the PHP script.

                  
                  $the_query = "SELECT * FROM `files` WHERE `user_id`=" . $_SESSION['user_id'] . " AND `key`='" . $key . "'";
                  
                  $result = mysql_query($the_query);
                  $row = mysql_fetch_array($result);
                  
                  $file = '/var/www/vhosts/www.example.com/httpsdocs/uploads/' . $row['id'] . '/' . $row['file'];
                  
                  header("Content-type: application/octet-stream");
                  header("Content-length: ".filesize($file));
                  header('Content-Description: File Transfer');
                  header("Cache-control: private");
                  header('Content-Disposition: attachment; filename=' . rawurlencode(basename($file)));
                  readfile($file);
                  

                  推荐答案

                  解决错误:Internet Explorer 无法从 www.example.com 下载 download.php",将这些标头添加到您的脚本中:

                  To solve the error : "Internet Explorer cannot download download.php from www.example.com", Add these headers to your script:

                  header("Pragma: ");

                  header("Cache-Control: ");

                  代码将从导致下载问题的标头中删除 Cache-Control.

                  The code will remove the Cache-Control from headers which makes the download problem.

                  上面的代码应该加在文件的顶部.

                  The above code should be added at the top of the file.

                  它对我们来说很好.

                  这篇关于用于下载文件的 PHP 脚本在 IE 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:电子邮件跟踪 - GMail 下一篇:在 php 5.5.1/apache 2.4.6 中忽略带有下划线的标题名称

                  相关文章

                2. <legend id='UXJJp'><style id='UXJJp'><dir id='UXJJp'><q id='UXJJp'></q></dir></style></legend>

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

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

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

                      <tfoot id='UXJJp'></tfoot>