Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Generate 404 error forcefully in Yii

I am using Yii framework and i want to generate 404 error if no recode found in database. Is there any smart way so that Yii default error handler should be invoked.

thanks in advance.

like image 309
Arif Avatar asked Apr 19 '12 15:04

Arif


1 Answers

throw new CHttpException(404,'The specified post cannot be found.');

http://www.yiiframework.com/doc/guide/1.1/en/topics.error

like image 79
Imre L Avatar answered Nov 25 '22 09:11

Imre L



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!