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

      1. <legend id='3VKjs'><style id='3VKjs'><dir id='3VKjs'><q id='3VKjs'></q></dir></style></legend>

      2. <small id='3VKjs'></small><noframes id='3VKjs'>

      3. 警告 feof() 期望参数 1 是资源

        时间:2023-09-21
          <bdo id='CGxzN'></bdo><ul id='CGxzN'></ul>
            • <i id='CGxzN'><tr id='CGxzN'><dt id='CGxzN'><q id='CGxzN'><span id='CGxzN'><b id='CGxzN'><form id='CGxzN'><ins id='CGxzN'></ins><ul id='CGxzN'></ul><sub id='CGxzN'></sub></form><legend id='CGxzN'></legend><bdo id='CGxzN'><pre id='CGxzN'><center id='CGxzN'></center></pre></bdo></b><th id='CGxzN'></th></span></q></dt></tr></i><div id='CGxzN'><tfoot id='CGxzN'></tfoot><dl id='CGxzN'><fieldset id='CGxzN'></fieldset></dl></div>
            • <small id='CGxzN'></small><noframes id='CGxzN'>

                  <tbody id='CGxzN'></tbody>
              • <tfoot id='CGxzN'></tfoot>

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

                  本文介绍了警告 feof() 期望参数 1 是资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我的错误日志因以下两个错误而失控

                  My error logs are getting out of control with the two below errors

                  warning feof() expects parameter 1 to be resource
                  

                  warning fread() expects parameter 1 to be resource
                  

                  负责的代码是

                  <?php
                      $file = '../upload/files/' . $filex;
                      header("Content-Disposition: attachment; filename=" . urlencode($file));
                      header("Content-Type: application/force-download");
                      header("Content-Type: application/octet-stream");
                      header("Content-Type: application/download");
                      header("Content-Description: File Transfer");
                      header("Content-Length: " . filesize($file));
                      flush(); // this doesn't really matter.
                  
                      $fp = fopen($file, "r");
                      while (!feof($fp)) {
                          echo fread($fp, 65536);
                          flush(); // this is essential for large downloads
                      }
                      fclose($fp);
                  ?> 
                  

                  我使用此代码进行标题下载,但现在它吓坏了 - 在有人问我尝试过什么之前,我尝试了谷歌,但仍然没有完全理解错误消息.

                  I used this code for header downloads but its freaking out right now - before anyone asks what I have tried, I tried google but still don't fully understand the error message.

                  推荐答案

                  fopen 失败并返回 false.false 不是资源,因此是警告.

                  fopen fails and returns false. false is not a resource, thus the warning.

                  在将 $fp 作为类似资源的参数注入之前,您最好对其进行测试:

                  You'd better test $fp before injecting it as a resource-like argument:

                  if(($fp = fopen($file, "r"))) {
                      [...]
                  }
                  

                  这篇关于警告 feof() 期望参数 1 是资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 MySQL 服务器上重新连接已经消失 下一篇:当 fopen() 失败时获取有意义的信息 (PHP/suPHP)

                  相关文章

                  最新文章

                    <bdo id='2JXdh'></bdo><ul id='2JXdh'></ul>

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

                    <small id='2JXdh'></small><noframes id='2JXdh'>

                    1. <legend id='2JXdh'><style id='2JXdh'><dir id='2JXdh'><q id='2JXdh'></q></dir></style></legend>
                      <tfoot id='2JXdh'></tfoot>