大飞_dafei

导航

yii2 behaviors

yii2 behaviors

1、使用控制过滤器,

        return [
            'access' => [
                'class' => AccessControl::className(),
                'rules' => [
                    [
                        'allow' => true,
                        'actions' => ['index'],
                        'roles' => ['@'],
                    ],
                    [
                        'allow' => true,
                        'actions' => ['index'],
                        'ips' => ['127.0.0.1'],
                    ]
                ],
            ]
        ];
    }

 




posted on 2017-12-22 16:03  大飞_dafei  阅读(84)  评论(0编辑  收藏  举报