Yii2 separates the front and back ends. backend and frontend are configured and used properly. However, third-party modules or self-developed modules are based on frontend, in addition, there is no response setting in the module to distinguish between the foreground and the background. At this time, if the module is registered to the frontend, the internal... yii2 separates the front and back ends. backend and frontend are configured and used properly. However, third-party modules or self-developed modules are based on frontend, in addition, there is no response setting in the module to distinguish between the front-end and the back-end. If the module is registered in frontend, the corresponding internal management controller can actually be accessed in frontend. I mean whether RBAC is used to control the elegant separation, but the front-end cannot access it at all.
Reply content:
Yii2 separates the front and back ends. backend and frontend are configured and used properly. However, third-party modules or self-developed modules are based on frontend, in addition, there is no response setting in the module to distinguish between the front-end and the back-end. If the module is registered in frontend, the corresponding internal management controller can actually be accessed in frontend. I mean whether RBAC is used to control the elegant separation, but the front-end cannot access it at all.
You can create a new module directory in the same directory as frontend and backend, store the public module, and then boot the module as needed. For example, to use the myModule module in frontend, add the following in config:
[ 'bootstrap' => [ 'myModule', ], 'modules' => [ 'myModule' => 'app\module\myModule', ],]
Then in the frontend project, you can use$module = myModule::getInstance();Access.
Reference http://www.yiichina.com/doc/guide/2.0/st...
The default advanced template of yii2 already distinguishes the foreground, background, and public directory.
Frontend
Backend
Common
Frontend and backend can depend on common at the same time.
However, frontend and backend do not depend on each other, and all dependencies are stored in the common
The module you created must also be separated by function
Front-end module with frontend
Backend
Common