web - Yii: how to respond with 404 -


how generate response in yii using $this->render, while setting answer code 404 instead of 200?

i want flow this:

if ($isok) {   $this->render('page', ...); } else {   // set 404 header     $this->render('error', ...); } 

you should throw exception instead:

if ($isok) {    $this->render('page', ...); } else {     throw new chttpexception("404", "your requested page not found."); } 

this render error view.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -