I am creating custom class to throw a error from zend as there is not built-in mechanism for this in zend. I am able to give proper response to the user. But I am having problem in returning status code for this.
$obj = $this->toJsonModel($result);
$this->getResponse()->setStatusCode(403);
error_log('Status Code' . $this->getResponse()->getStatusCode());
return $obj;
I am getting response in $obj
in Json format. Then I am setting status code to 403 for this API which I created. And then I am returning $obj
from this controller.
But I am not getting 403 error when I tried this code. It's always showing 200 as a status code.
其他一些代码在执行此操作时引起问题,每次给出200,但是当我重新执行一些操作时,它开始工作。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.