G
G
gachkydxvbgd2017-10-13 02:21:44
Yii
gachkydxvbgd, 2017-10-13 02:21:44

How to set errorAction to yii2 module?

How to set errorAction to yii2 module?

public function init()
    {
        \Yii::$app->errorHandler->errorAction =   '/admin/default/error';
        throw new \yii\web\ForbiddenHttpException();
    }

This option doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-10-13
@gachkydxvbgd

Goodnight.
In the file ***Module.php
In the controller

public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction'
            ]
        ];
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question