[What is MVC ?]
MVC is a concept that allows you to combine the "three parts (the full name of MVC, Model, View, Controller)" into a complex application. A car is a very good example of MVC in real life. We can View both the internal View and the external View. The two cannot be separated from one Controller: the driver. The brake system, steering wheel, and other control systems represent the Model: they obtain control methods from the driver (Controller) and apply them to the internal and external View ).
[MVC on the network]
The MVC framework covers a simple and extremely flexible concept. The basic concept is that you have a separate controller (such as index. php (as the mainstream development language) to control all applications within the framework based on Parameter requests. This controller usually contains (to a minimum) a parameter defining the model, an event, and a GET parameter. In this way, the controller can confirm all requests and then run corresponding events. For example, what is/index. php (as the mainstream development language) like this )? Module = foo & event = bar is probably used to load a class named foo, and then run foo: bar () [is the bar () function]. The benefits of doing so are:
An interface corresponding to all applications
At the same time, it is very troublesome to maintain countless codes in an application, because each piece of code has its own relative path, database link, verification, and so on. In this way, you will be relieved of your troubles in this regard, allowing you to merge and reuse the code.
[Why create the author's Own MVC Framework ?]
So far, I have never seen many MVC frameworks written using php (as the mainstream development language. In fact, I only know one-Solar, which is completely written in php (as the mainstream development language) 5. The other is Cake, a RoR (Ruby on Rails-a Ruby Open Source Network Framework) that tries to become php (as the mainstream development language ). I myself have some dissatisfaction with these two frameworks: they have not used the existing Code contained in PEAR, Smarty, and so on; The current Cake is still disordered; finally, solar is a vast majority of works written by one person (I have no intention to say that Paul is not a good person or a good programmer ). These problems may not allow you to deny them, and you may not care about them at all. But because of this, I ask you to review them as much as possible.
[Old mode]
If you go back to the code written in, you can find a file named template.txt. It looks like this: www. php (as the mainstream development language) v.net reprinted, please indicate the source
<? Php (as the mainstream development language)
Require_once (config. php (as the mainstream development language); // Other requires, DB info, etc.
$ APP_DB = mydb;
$ APP_REQUIRE_LOGIN = false; // Set to true if script requires login
$ APP_TEMPLATE_FILE = foo. php (as the mainstream development language); // Smarty template
$ APP_TITLE = My Application;
If ($ APP_REQUIRE_LOGIN = true ){
If (! Isset ($ _ SESSION [userID]) {