Hmvc(Hierarchical-Model-View-Controller). It can also be called layered MVC. The so-called MVC model is classified by level. The simple explanation is that MVC is subdivided into multiple sub-MVC, and each module is divided into one MVC.
The advantage of using hmvc is that it can reduce coupling between functional modules and improveCodeReusability makes every function Independent. Each module has its own MVC structure, which is a bit like ActiveX Control. Each control has its own behavior, and controls do not affect each other.
Codeigniter Structure Diagram
Application |-controllers |-controllers1.php |-controllers2.php | -... |-models |-models1.php |-models2.php | -... |-views |-views1 |-index. PHP |-footer. PHP | -... |-views2 |-index. PHP |-footer. PHP | -... | -...
The above is the original codeigniter structure. If it is hmvc, the structure is:
application |-modules |-modules1 |-controllers. phpci |-models. PHP |-views |-index. PHP |-footer. PHP | -... |-modules2 |-controllers. PHP |-models. PHP |-views |-index. PHP |-footer. PHP | -... | -.... |-controllers | -... |-models | -... |-views | -...
note that the above is only a manifestation of the hmvc folder structure of the codeigniter framework. It does not mean that hmvc must follow this structure. Language or framework to design its hmvc structure.