1 、MVC 分层职责和处理流程

来源:互联网 发布:js 字符串转date 编辑:程序博客网 时间:2024/06/15 03:45
Models, which contain or represent the data that users work with. These can be simple view models, which just represent data being transferred between views and controllers; or they can be domain models, which contain the data in a business domain as well as the operations, transformations, and rules for

manipulating that data.


Views, which are used to render some part of the model as a UI.


Controllers, which process incoming requests, perform operations on the model,and select views to render to the user.



模型:包含用户要处理的数据,分为view models和domain models,业务逻辑放到这里面

视图:仅仅负责将模型展示出来

控制器:执行请求、对模型的操作并选择视图展示给用户