2017-06-27 54 views
0

當我送崗位查詢actionAnswerTest我得到一個異常:YII2錯誤ForbiddenHttpException

[error] 6754#6754: *479979 FastCGI sent in stderr: "PHP message: An Error occurred while handling another error: exception 'yii\web\ForbiddenHttpException' with message 'You are not allowed to access this page.'

規則控制器:

public function behaviors() 
{ 
return [ 
    'access' => [ 
     'class' => AccessControl::className(), 
     'rules' => [ 
      [ 
       'actions' => ['index', 'partial', 'complete', 'answer', 'answer-test'], 
       'allow' => true, 
       'roles' => ['@'], 
      ], 
     ], 
     'denyCallback' => function($rule, $action) { 
      return Yii::$app->getResponse()->redirect('denied')->send(); 
     }, 
    ], 
    'verbs' => [ 
     'class' => VerbFilter::className(), 
     'actions' => [ 
      'update' => ['post'], 
      'test-partial' => ['post'], 
      'test-complete' => ['post'], 
      'test-answer' => ['post'], 
     ], 
    ], 
    [ 
     'class' => ContentNegotiator::className(), 
     'only' => ['update', 'answer'], 
     'formats' => [ 
      'application/json' => Response::FORMAT_JSON, 
     ], 
    ], 
]; 
} 

查詢後通過授權的用戶發送。

回答

0

幫助重命名actionAnswerTestactionAnswertest,並answer-testanswertest