As we know, in Yii, we can set the error handler to display some useful message to the user.

But, when i want to display different views in different modules, how to do it?

Here is the way.

 

In your module, here let say we have a admin module, there is AdminModule.php in it, 

then add the code as below:

public function init()
{
    //other codes...
    Yii::app()->setComponents(array(
        'errorHandler'=>array(
        'errorAction'=>'admin/default/error',
        ),
    ));
}

after that, we point the error handler to admin/default/error.

 

Have fun with Yii! 

 

相关文章:

  • 2021-08-27
  • 2021-09-16
  • 2022-01-31
  • 2021-11-18
  • 2021-07-25
  • 2021-05-18
  • 2021-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-02
  • 2021-09-14
  • 2021-09-06
  • 2021-12-30
  • 2021-11-14
相关资源
相似解决方案