Answer the question
In order to leave comments, you need to log in
What is the ForbiddenHttpException error?
SiteController
public function beforeAction(){
if(Yii::$app->user->can('admin')){
return true;
} else {
throw new ForbiddenHttpException;
}
}
An Error occurred while handling another error:
exception 'yii\web\NotFoundHttpException' with message 'The requested page does not exist.' in A:\my_projects\advanced.local\www\backend\controllers\SiteController.php:62
Stack trace:
#0 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Controller.php(149): backend\controllers\SiteController->beforeAction(Object(yii\web\ErrorAction))
#1 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('error', Array)
#2 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\web\ErrorHandler.php(85): yii\base\Module->runAction('site/error')
#3 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\ErrorHandler.php(109): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#4 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#5 {main}
Previous exception:
exception 'yii\web\NotFoundHttpException' with message 'The requested page does not exist.' in A:\my_projects\advanced.local\www\backend\controllers\SiteController.php:62
Stack trace:
#0 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Controller.php(149): backend\controllers\SiteController->beforeAction(Object(yii\base\InlineAction))
#1 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('', Array)
#2 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\web\Application.php(84): yii\base\Module->runAction('site', Array)
#3 A:\my_projects\advanced.local\www\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#4 A:\my_projects\advanced.local\www\backend\web\index.php(18): yii\base\Application->run()
#5 {main
Answer the question
In order to leave comments, you need to log in
He writes to you that he did not find the page in SiteController.php on line 62. Probably the wrong view address. What do you have in SiteController.php on line 62? Why did you post beforeAction()? The error is not in it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question