小编Art*_*tur的帖子

在zend中删除http响应头

我在Zend Framework(1)中的应用程序有问题.

在一个特定的操作中,我尝试删除一些标题但作为响应我仍然收到这些标题:

    $this->getResponse->clearAllHeaders()
                      ->clearRawHeaders();
    $this->getResponse->setHeader('A-Header', 'headervalue');
Run Code Online (Sandbox Code Playgroud)

我希望回复是:

    HTTP/1.1 XXX Some HTTP status code
    A-Header: headervalue
Run Code Online (Sandbox Code Playgroud)

但它是:

   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
Run Code Online (Sandbox Code Playgroud)

如何删除日期,服务器,X-Powered-By,Vary,Content-Lenght,Content-Type?至少Content*标题.

谢谢

php zend-framework http-headers

3
推荐指数
1
解决办法
1712
查看次数

标签 统计

http-headers ×1

php ×1

zend-framework ×1