Calling runaction between different modules in yii2

Time:2020-11-19

 

1、 Call the same controller under different action modules

// in the first mock exam of frontend\controllers\TestController\actionTest,
//Frontend / Controllers / newcontroller / actionnewaction method
Yii::$app->runAction('new/new-action');

 

2、 Call actions under different modules

// in the frontend\controllers\TestController\actionTest method, call another module.
//The method of backend / Controllers / newcontroller / actionnewaction
return (new NewController($this->id, $this->module))->runAction('new-action');

 

Recommended Today

Quickly create a document project with vitepress

In fact, to develop a project is the most necessaryOperation documentThe quality of documents determines the development process, development specification and so on. For the front-end framework, the document is the most friendlyvueIt is not only the framework of Chinese people, but also the document supports Chinese. Check Vue’s official documents, andVue-Router,Vuex,Vite. It is found […]