MVC 总结

以下内容摘自 PHP for Absolute Beginners, Thomas Blom Hansen & Jason Lengstorf

The model-view-controller (MVC) design pattern is common approach to organizing scripts consistently. Using a consistent approach to organizing your scripts can help you develop and debug faster and more effectively.

At its most basic, MVC separates coding concerns into three categories: models, views and controllers. A model is a piece of code that represents data. You models should also hold most logic involved in the system you're building. A view is a piece of code that shows information visually. The information to be displayed by the view is received from a model. A controller is a piece of code that retrieves input from users and sends commands to relevant model(s). In short MVC separates user interactions from visual representation from system logic and data.

原文地址:https://www.cnblogs.com/Patt/p/6189746.html