我尝试发送 Last-Modified 标头。我可以在本地计算机上运行项目时看到它,但是当我在虚拟主机上运行它的副本时,没有 Last-Modified 标头。
class InfoController extends Zend_Controller_Action
{
public function indexAction(){
$arr = strip_tags($this->_getParam('link'));
$material = new Application_Model_InlineMenus();
$mat = $material->preparematerial($arr);
$header= $this->getResponse()->setHeader("Last_Modified", gmdate("D, d M Y H:i:s", strtotime($mat['created']))." GMT", true);
//other parts of code
}
}
这就是我在本地机器上运行项目时在萤火虫中所拥有的
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection Keep-Alive
Content-Length 4563
Content-Type text/html
Date Fri, 15 Feb 2013 10:31:49 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive timeout=5, max=99
Last-Modified Thu, 14 Feb 2013 12:41:31 GMT
Pragma no-cache
Server Apache/2.2.22 (Win32) PHP/5.3.13
X-Powered-By PHP/5.3.13
这就是我的托管服务
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection keep-alive
Content-Encoding gzip
Content-Type text/html; charset=UTF-8
Date Fri, 15 Feb 2013 10:34:06 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Pragma no-cache
Server nginx/1.1.10
Transfer-Encoding chunked
X-Powered-By PHP/5.3.21
本地项目和实际项目之间只有一个区别——我在 www 目录中使用 .htaccess 将请求重定向到 www/public 目录。
UPD。我创建了插件并在 preDispatch() 中尝试设置标头并且我有 http-code 500
问题解决:禁用 SSI