主页 > 编程资料 > Yii >
发布时间:2018-04-23 作者:apizl 阅读:352次

Yii2自带的权限控制默认只支持两个角色:

guest(游客,没有登录的,用?表示)

authenticated (登录了的,用@表示)

 'access' => [
                'class' => AccessControl::className(),
                'rules' => [
                    [
                        'actions' => [],
                        'allow' => true,
                    ],
                    [
                        'actions' => ['index', 'add'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],

clipboard.png


文章由爱资料原创本文地址:https://www.apizl.com/archives/view-134080-1.html,转载请以链接形式标明本文地址!
关键字词: