Answer the question
In order to leave comments, you need to log in
How to correctly call a controller method from another template?
There is yii2 advanced template.
With the following template
-api
-console
-frontend
-backend
The names speak for themselves.
Let's say that I want to call the api controller method from fronted-a.
Now I do it through curl
$jsonContent = $сurl->post($IP . '/v1/user/auth', Yii::$app->getRequest()->post());
Answer the question
In order to leave comments, you need to log in
Late reply.
you just need to connect the module from another template to the required template (in the main.php config), then you can use the run method
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question