P
P
Petr Ponomarev2016-11-27 01:29:01
Yii
Petr Ponomarev, 2016-11-27 01:29:01

Error when using access control filter what did I do wrong?

Filter controller
<?
namespace app\controllers;
use yii;
use yii\web\Controller;
use yii\filters\AccessControl;
class BehaviorsController extends Controller
{
public function behaviors()
{
return
[
'access' => [
'class' => AccessControl::className(),
'rules' =>[
[
'allow' => true,
'controllers' => ['SiteController'],
'actions' => ['reg', 'login'],
'verbs' => ['GET', 'POST'],
'roles' => ['?']
],
]
]
]
];
}
}
The SiteController itself
<?php
namespace app\controllers;
use yii;
use app\models\LoginForm;
use app\models\RegForm;
use app\models\User;
class SiteController extends BehaviorsController
{
/**
* Displays homepage.
*
* return string
*/
public function actionIndex()
{
return $this->render('index');
}
/**
* Logout action.
*
* return string
*/
public function actionLogout()
{
Yii::$app->user->logout();
return $this->goHome();
}
}
error:
ff8f40daeb8642629f52b16c36ef127c.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-11-27
@Petrdis

Your request does not get into the controller, I didn’t really read the code, since the error is visible before it. Check config.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question