MVC is a combination of three letters, M-model, V-view, and C-controller. These can be easily searched on Baidu, and the online interpretation of these three parts is too general, so that people cannot fully understand the meaning of MVC. Here I will briefly talk about my understanding of the three MVC parts and say that MVC is a combination of three letters, M-model, V-view, and C-controller. These can be easily searched on Baidu, and the online interpretation of these three parts is too general, so that people cannot fully understand the meaning of MVC. Here I will give a brief introduction to my understanding of the three parts of MVC and describe their specific responsibilities. I use web script PHP as an example. We know that the most data transmitted between the browser and the web server During website access, so I think the three parts of MVC are for data generation and transmission, and display and generate. The M-model is responsible for data generation and processing. It can generate data by itself, and also obtain data from other storage media such as files and databases. It is also responsible for data processing, including packaging and storage of data. It can also be a combination of these actions. The V-view displays data. Its task is to express data in various forms. Sometimes the data is a piece of text, and the work of the view may be to display the text on the webpage and add various styles to the text. Sometimes the data is a number, and the view may be used to draw a table or draw a line segment trend to express the data. C-controller. On the Internet, the meaning is roughly accurate to link views and models. The specific work of the controller is to find the appropriate model, pass the user's request (after slight modification) to it, get the data returned by the model, and then the data (after slight modification) to the appropriate view. The relationship between the three is data, but the three have different actions on the data. The "model" is responsible for the formation of data, including a lot of business logic, and data storage on external media. The controller only processes a little bit of data and sometimes does not need to process it. Views do not process data, but only modify and present the data. The above is my small understanding of MVC.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.