Skip to content

Instantly share code, notes, and snippets.

@YasinPatel
Last active January 16, 2019 07:48
Show Gist options
  • Save YasinPatel/09767f24617b6911c845f1b2ec9e43e3 to your computer and use it in GitHub Desktop.
Save YasinPatel/09767f24617b6911c845f1b2ec9e43e3 to your computer and use it in GitHub Desktop.
Module wise Error Page in Yii2
Yii::$app->errorHandler->errorAction = 'studconsult/default/error';
<?php
namespace app\modules\admin;
class Module extends \yii\base\Module
{
public $controllerNamespace = 'app\modules\admin\controllers';
public function init()
{
parent::init();
Yii::$app->errorHandler->errorAction = 'admin/default/error'; // add this line
}
}
@faizalmansor
Copy link

Need to add use Yii; after namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment