-- display and logic phase separation --
Force the function into two parts:1. The HTML part responsible for the display 2. PHP code responsible for business logic processing
HTML is primarily responsible for the presentation of parts, where mutable data is populated with dynamic scripting PHP.
Such a mixed file is generally called a template file. Because users cannot request template files directly, they are hidden through Apache distributed configuration Files .
In the Apache master configuration file (httpd-vhosts.conf), add one more line of code when you configure permissions:
AllowOverride All
Next, create the . htaccess file in the template file, and write the following code.
Content users in the View template file will no longer be able to access the
Summary: Advantages of display and logical phase separation
-Better management code, high maintainability
-Improve code reusability and efficiency
--MVC thought --
When a website features a lot, such as e-commerce website, a lot of functions are relatively independent data processing module permutation combination. And the idea of MVC architecture, that is, on the basis of display and logical separation, and then the logic of all the data processing modules are extracted separately, in the required functions to debug.
Data processing units in the M-model project
V-view Project for result presentation units (template files)
A unit in the C-controller project that is responsible for the overall process scheduling of a function
At this point the browser only needs to interact with C.
Summary: The concept of MVC architecture, refers to the relationship between the code in the project, does not determine the grammatical form, the process-oriented and object-oriented can use the MVC architecture idea.
PHP Learning BBS Forum Project-web Architecture and MVC ideas