MVC (Model-view-controller, model-View-controller mode) is used to represent a software architecture pattern. It divides the software system into three basic parts: model, view, and controller.
The purpose of the model-view-controller mode is to implement a dynamic program design that simplifies the subsequent modification and expansion of the program, and makes it possible to reuse a part of the program. In addition, this mode makes the program structure more intuitive by simplifying the complexity. By separating the basic parts of the software system, it also gives the functions of each basic part. Professionals can be grouped by their own expertise:
· Controller – The function the programmer should have to write the program, mainly to implement the Program logic control (Implementation algorithm, etc.)
· View – Graphical interface design by the interface designer, i.e. the page effect displayed by the client
· Model – control management of the data by the program
M: Is database V: equivalent to the front page C: equivalent to the background
But they are all relatively independent.
The model data model is used to encapsulate data related to the business logic of the application and how to handle the data. The model has rights to direct data access, such as access to the database. "Model" does not depend on "view" and "Controller", that is, the model does not care how it will be displayed or how it is manipulated. However, changes in the data in the model are generally advertised through a refresh mechanism. To implement this mechanism, the views that are used to monitor this model must be registered in advance on this model, so that the view can understand the changes that have occurred on the data model.
The view view layer is capable of achieving a purposeful display of data (in theory, this is not required). There is generally no logic on the program in the view. To implement the Refresh feature on the view, the view needs to access the data model it monitors, so it should be registered with the data it is monitoring beforehand.
Controller controllers play an organizational role across different levels to control the flow of applications. It handles the event and responds. An "event" includes the user's behavior and changes on the data model.
PHP has always lacked a good, fully functional model-view-Controller (MODEL-VIEW-CONTROLLER,MVC) framework. The MVC framework allows programmers to organize their code into three different functional areas:
* The model contains all the code related to your database and other data structures. If you have a table named pages, you have a model that has functions for selecting, creating, updating, and deleting records from a table.
* View contains all display and UI elements-javascript code, cascading Style Sheets (CSS), HTML, and even PHP.
* The controller ties everything together. Each function in the controller represents a destination or route. Mainly embodied in the logical control.
No related posts.
What is the MVC pattern?