Yii框架学习 5-2 授权--存取过滤控制器ACF

1、用户只能在10.31号当天访问这个页面

class PostController extends Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
            'access' => [
                'class' => AccessControl::className(),
                'rules'=>
                [
                    [
                        'actions' => ['index', 'view'],
                        'allow' => true,
                        'roles' => ['?'],
                    ],
                    [
                    'actions' => ['index', 'view', 'update', 'create', 'delete'],
                    'allow' => true,
                    'roles' => ['@'],
                        ]
                ],


            ]
        ];
    }
}
原文地址:https://www.cnblogs.com/gaogaoxingxing/p/12780339.html