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

    2. <small id='H1UvG'></small><noframes id='H1UvG'>

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

        304未修改问题

        时间:2023-11-30

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

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

              <tbody id='bklCK'></tbody>

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

                • <bdo id='bklCK'></bdo><ul id='bklCK'></ul>
                • 本文介绍了304未修改问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  对不起,可能是错误的标题.我正在编写一些代码来处理 If-Modified-Since 和 If-None-Match 请求作为缓存的一部分.除了 PHP 在标题之后返回一些内容(一个空行)之外,一切都很完美.页面内容应该是空的.我使用的代码是:

                  Sorry for the probably wrong title. I am writing some code to handle If-Modified-Since and If-None-Match requests as part of caching. Everything works perfect except for that PHP returns some content (an empty line) after the headers. The page content should be empty instead. The code that I am using is:

                  <?php
                  $lastmod = filemtime($f);
                  $etag = '"'.dechex($lastmod).'"';
                  if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $last_mod || $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) {
                    header('HTTP/1.1 304 Not Modified');
                    header('Content-Length: 0');
                    exit();
                  }
                  ?>
                  

                  推荐答案

                  终于解决了这个bug.Gzip 是罪魁祸首.由于我也在压缩对 If-Modified-Since 和 If-None-Match 请求的响应,因此 gzip 在响应中添加了一些字节(一种 gzip 标头).现在我停止了对 If-Modified-Since 和 If-None-Match 请求的 gzip 响应,它就像一个魅力.

                  Finally solved this bug. Gzip was the culprit. Since I was gzipping the responses to If-Modified-Since and If-None-Match requests too, gzip was adding a few bytes (kind of a gzip header) to the response. Now I have stopped gzipping responses to If-Modified-Since and If-None-Match requests, and it works like a charm.

                  这篇关于304未修改问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:流式传输 PDF 附件时如何强制使用另存为对话框 下一篇:PHP如何将标题位置定位到父目录中的页面?

                  相关文章

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

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

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

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