redirect Access rules with Yii

后端 未结 4 623
暗喜
暗喜 2021-01-02 09:06

I am doing an app that requires authentication. In the index page of the app, I specified access rules like this

public function accessRules() {
    return a         


        
4条回答
  •  北荒
    北荒 (楼主)
    2021-01-02 09:33

    this one worked for me since yii 1.1.11:

        array('deny',  // deny all users
                'users'=>array('*'),
                'deniedCallback' => $this->redirect('/')
            ),
    

    or use a static method in a Class:

    'deniedCallback' => array('ClassName', 'staticMethodName'),
    

提交回复
热议问题