【问题标题】:PHP Last-Modified header not sent?PHP Last-Modified 标头未发送?
【发布时间】:2014-07-31 16:16:27
【问题描述】:

所以我在我的 PHP 文件的最顶部有这个:

<?php
// Set headers
header('Content-Type: text/html; charset=UTF-8');
header('Content-Style-Type: text/css');
header('Content-Script-Type: application/javascript');
header('HTTP/1.1 200 OK');
header('Content-language: en-US');
header('X-Powered-By: ');
header_remove('X-Powered-By');
header('Last-Modified: Tue, 01 Jan 2013 00:00:00 GMT');
header('Cache-Control: no-store, no-cache, max-age=0, must-revalidate');
header('Pragma: no-store, no-cache, max-age=0, must-revalidate');
header('Expires: Tue, 01 Jan 2013 00:00:00 GMT');
?>

因此,当我在我的网站 URL 上检查 Firefox 控制台的 NET 选项卡时,我没有看到 Last-Modified 标头。有什么建议吗?

【问题讨论】:

  • 能否请您发布标题响应?
  • 公平地说,您是在告诉浏览器不缓存任何内容,他必须重新验证所有内容。所以最后修改的标题无关紧要。
  • 哦,现在我明白了!我是多么的愚蠢!谢谢!将此作为答案发布,以便我接受。
  • 确保您的 .htaccess 文件中没有“Header unset Last-Modified”

标签: php http-headers last-modified


【解决方案1】:

您告诉浏览器不缓存任何内容,他必须重新验证所有内容。所以最后修改的标题无关紧要。

【讨论】:

  • -1 浏览器是否必须重新验证资源并不重要。我来到这里研究如何获取该标头,即使 HTML 具有无缓存策略,因为我在 AJAX 请求中使用它。不过还是没有运气。
猜你喜欢
  • 2019-09-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-23
  • 2011-04-23
  • 2018-10-23
  • 2010-12-28
相关资源
最近更新 更多