YII how to handle custom 404 error page along with other error pages

前端 未结 4 2296
执笔经年
执笔经年 2021-02-20 05:05

I want to display 404 error page for that i have made error404.php file in my protected/view/system folder.

By default i have Sitecontroller and it contained error acti

4条回答
  •  醉话见心
    2021-02-20 05:39

    Whenever errors occur, the action error in siteController is called. you can customize the error route in that action, you can do something like this:

    if(404==Yii::app()->errorHandler->error->code){
         //go to custome error page
    else
       //code default error.php
    

提交回复
热议问题