2009年6月28日星期日

Re: [fw-mvc] setHttpResponseCode doesn't work ?

-- ert256 <ert256@gmail.com> wrote
(on Sunday, 28 June 2009, 02:51 PM +0200):
> This is my index controller :
> <?php
>
> class IndexController extends Zend_Controller_Action
> {
> public function indexAction()
> {
> $this->getResponse()->setHttpResponseCode(404);
> }
> }
>
> But the request returns HTTP 200 response. How can I force it to return
> 404 ?
>
> I have configured layout, and ViewRenderer automatically, and I use
> ZendFramework 1.8.2.

I've just tested this locally, and it's working fine -- I received the
expected HTTP response code when I checked in FireBug. Perhaps you're
behind a proxy server?

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: