【发布时间】:2017-01-29 08:28:06
【问题描述】:
我使用 Yii2 框架
这是我在ShippingController中的行为功能
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// deny all POST requests
// [
// 'actions' => ['index', 'create'],
// 'allow' => TRUE,
// ],
[
'actions' => ['index', 'create', 'init'],
'allow' => true,
'roles' => ['?'],
'matchCallback' => function ($rule, $action)
{
return $action->controller->redirect('action');
}
],
'denyCallback' => function ($rule, $action)
{
return $action->controller->redirect('not');
}
// everything else is denied
],
],
];
}
matchCallback 效果很好,但是
在denyCallback 我有这个错误:
错误 调用未定义的方法 Closure::allows()
我的问题是什么???!
【问题讨论】:
标签: yii yii2 yii2-advanced-app yii2-basic-app