簡體   English   中英

為什么 Apache 不使用最后修改的 header 服務 PHP 文件?

[英]Why doesn't Apache serve PHP files with a Last-Modified header?

這是設計使然嗎?

On my Debian (Etch) server I noticed that Apache (2.2) will not send a Last-Modified header when serving PHP (mod_5.2.0) files (we're talking plain-jane echo 'Hello World'; PHP files).

Additionally, I noticed that the header Accept-Ranges is also not served by Apache for PHP files, although my main conern for the moment is the Last-Modified header.

PHP 是可以更改的動態頁面。 所以 Apache 無法知道 Last-Modified header。

您可以添加自己的 header :

 header('Last-Modified: GMT time');

當然,如果您需要這個 header,也許您正在尋找管理請求 header If-Modified-Since。

您可以在$_SERVER['HTTP_IF_MODIFIED_SINCE']中找到它

它僅與 static 文件一起發送。 php 文件不是 static。

但您可以自己發送,請參閱http://www.php.net/manual/en/function.getlastmod.php#30514示例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM