How to Generate 404 error forcefully in Yii
16,943
throw new CHttpException(404,'The specified post cannot be found.');
http://www.yiiframework.com/doc/guide/1.1/en/topics.error
Author by
Arif
Updated on June 16, 2022Comments
-
Arif almost 2 years
I am using Yii framework and i want to generate
404
error if no recode found in database. Is there any smart way so thatYii default error handler
should be invoked.thanks in advance.
-
Highmastdon almost 11 years@imre-l Is it possible to return an Http Error without throwing an exception? Because I'm using MailLogRoute and now even simple 403 errors are mailed to me. It's an intentional error, so not a failure of a programmer so I think it shouldn't be an Exception. Is there a 'cleaner' way? > just return a http response with 403 without using CHttpException?
-
diego nunes almost 11 yearsHave you tried using "200" as code? It's the "OK", so I think the server should let it pass.