Answer the question
In order to leave comments, you need to log in
Problem in Yii2 Yii::$app->runAction()?
Hello!
I have such a problem
, let's say there are such variables in the main controller and it is always available (exactly in the form)
public function beforeAction($action){
$this->view->code = 'codeblabla';
return parent::beforeAction($action);
}
$this->view->svg = include_once("../components/svg.php");
public function beforeAction($action){
$this->view->svg = include_once("../components/svg.php");
return parent::beforeAction($action);
}
Answer the question
In order to leave comments, you need to log in
Why set it in beforeAction, this is the same variable jerking with each request, and the result does not depend on the request. This is weird. Create a public variable in the controller:
In the form:
Or even Yii::$app->params['someName']
put in an array
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question