0

我已经实施了一组规则,但是当用户尝试访问受限区域时,我得到的是文本输出,而不是一个很好的 boostrap 警报。我怎样才能让它再次工作?

规则:

public function behaviors()
{
    return [
        'access' => [
            'class' => AccessControl::className(),
            'only' => ['index', 'view'],
            'rules' => [
                [
                    'roles' => ['@'],
                    'actions' => ['index', 'view'],
                    'allow' => true,
                ],
            ],
        ],

异常消息:

An Error occurred while handling another error:
exception 'yii\web\ForbiddenHttpException' with message 'You are not allowed to perform this action!.' in ###\vendor\yiisoft\yii2\filters\AccessControl.php:151
Stack trace:...
4

1 回答 1

0

Thanks Bizley for your help. I followed your instructions and discovered that I rather stupidly copied my rules to my site/error page meaning that I accidentally blocked the ability to see the error page!!! I removed the offending rule and all is working.

于 2016-10-20T19:13:08.257 回答