MVC,MVC Frame
Mvc
is not a technology, is a kind of thought, the user operation of the site, and the background of the user operation of the processing (including the operation of the database) a separate idea.
Background PHP is always called by the user's behavior, to set the operation entry for the user's behavior,
Operation Portal : The essence is to use the URL (only one privlege.php?action= value, goods.php?action= value)
Backstage :
Parse URL to get URL according to action to Judge C in ==>mvc
According to the different action (behavior) Operation database, get the M in data ==>mvc
using the include introduces an HTML file (template) for echoing information to the user ==> MVC v
M: (module) model is mainly used to manipulate the corresponding data table (table corresponding class goods.class.php, category.class.php, user.class.php)
V: (view) is an HTML document for hosting PHP echo data
C: (Controller) controllers are mainly used for business logic processing, the direction of the control program flow
Image metaphor:
The user is the company's big Boss
C (privilege.php, goods.php, index.php) Company's mid-level
The user issued a command, the company middle-level received the command (a command can be divided into several steps: 1, read data is a step, 2, echo data to the user), the company's middle school sent the younger brother 1 (user.class.php, goods.class.php) to read data, younger brother 1 to return the data to the company middle , the company to the middle of the data to the younger brother 2, the younger brother and second display data.
user.class.php, goods.class.php why to inherit DB class.
There are only four ways to operate a database. This type of operation is applied to different modules and will reflect different transactions. Therefore, it is not possible to encapsulate the business of each module in the DB class, using model classes to encapsulate the different services of the site module.
The user is manipulated by the programmer "expected" behavior, the user can only click the button or a link, that a linked href is designed by the programmer.
MVC diagram:
Expand:
http://www.bkjia.com/PHPjc/1117392.html www.bkjia.com true http://www.bkjia.com/PHPjc/1117392.html techarticle MVC,MVC Framework MVC is not a technology, is a kind of thought, the user operation of the site, and the background of the user operation of the processing (including the operation of the database) a separate idea. Backstage ...