我在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之外,這些標題每個都有其用途。 –