yii2:在denyCallback中调用未定义的方法Closure::allows()
我使用Yii2框架 这是我在yii2:在denyCallback中调用未定义的方法Closure::allows(),yii,yii2,yii2-advanced-app,yii2-basic-app,Yii,Yii2,Yii2 Advanced App,Yii2 Basic App,我使用Yii2框架 这是我在ShippingController public function behaviors() { return [ 'access' => [ 'class' => \yii\filters\AccessControl::className(), 'rules' => [ // deny
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
],
],
];
}
我的工作很好,但是
在denyCallback
中,我有以下错误:
错误
调用未定义的方法Closure::allows()
我有什么问题 将
denyCallback
元素移到规则数组之外它需要与
类
和规则