redirect Access rules with Yii

后端 未结 4 612
暗喜
暗喜 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:20

    Since Yii v1.1.11 you can do the same thing with a callback and a closure, and just the default classes:

    array('deny',
    'actions'=>array('index','register','login','password'),
    'users'=>array('@'),
    'deniedCallback' => function() { Yii::app()->controller->redirect(array ('/home/index')); }
    ),
    

提交回复
热议问题