我在Zend Framework(1)中遇到了一个应用程序问题。在zend中删除http响应标头
在一个特定的动作我尝试删除一些信息,但是在响应我仍然收到这些头:
$this->getResponse->clearAllHeaders()
->clearRawHeaders();
$this->getResponse->setHeader('A-Header', 'headervalue');
我期待的回应是:
HTTP/1.1 XXX Some HTTP status code
A-Header: headervalue
却是:
HTTP/1.1 XXX Some HTTP status code
Date: Sun, 14 Apr 2013 16:26:59 GMT
Server: Apache/2.2.16 (Debian)
X-Powered-By: PHP/5.3.3-7+squeeze15
Vary: Accept-Encoding
Content-Length: 0
Content-Type: text/html
如何删除Date,Server,X-Powered-By,Vary,Content-Lenght,Content-Type?至少Content *标头。
谢谢
在其应用程序的一部分,你清楚吗? – zavg
嗨zavg。我试图在几个方面做到这一点 - 在一个特定的行动,在postDispatch钩子,在dispatchLoopShutdown挂钩。但没有成功... – Artur
你为什么想这样做?除了X-Powered-By之外,这些标题每个都有其用途。 –