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
Post a Comment