【Foreword】
This article summarizes the concepts related to MVC. If there is any misunderstanding, please correct me
【main body】
(1) What is MVC?
A design pattern that enforces the separation of logic, output, and user input. Divide the whole project into three parts
Logic ----> Model M
Output -----> View V
Enter -----> Controller C
(2) Programming stage
The whole development goes through 3 stages
①Mixed programming stage
The popular understanding is the mixing mode, which is to write PHP code and HTML in one file
Advantages: high efficiency;
Disadvantages: not easy to maintain (front-end and back-end code are mixed together);
②Template engine stage
Typical advantages of template engines such as smarty engines
: separate front-end output and back-end logic code;
Disadvantages: Because there is one more template engine processing than mixing, the efficiency is better than the first one;
③MVC design stage
Benefit: Forces separation of user input, logic, and output. Much improvement in maintenance
Disadvantages: The efficiency is lower than the previous two modes. It can be compensated by the improvement of hardware
.