This article analyzes the four kinds of URL access methods of thinkphp. Share to everyone for your reference. The specific analysis is as follows:
One, what is MVC
Thinkphp's MVC pattern is very flexible, even if only three and one can run.
M-model write the Model class to manipulate the data
V-view Write HTML file, page rendering
C-controller Write class file (UserAction.class.php)
Ii. features of thinkphp MVC (Simple Understanding)
third, the thinkphp of the MVC corresponding directory (simple to understand)
M project directory/application directory/lib/model
V project directory/application directory/TPL
C project directory/application directory/lib/action
iv. URL Access C (easy to understand)
Five, 4 ways to access the URL (this is the key!!) )
1.PATHINFO Mode -focus on the following use very much, if you want to pass multiple parameters can use the key 1/value 1/Key 2/value 2 method
Copy Code code as follows:
http://domain name/project name/Entry file/Module name/method name/Key 1/value 1/Key 2/value 2
2. Normal mode is also known as rewrite mode
Copy Code code as follows:
http://domain name/project name/entry file? m= Module name &a= method name & key 1= value 1& key 2= value 2
3.REWRITE Rewrite mode , remove entry file for SEO optimization
Copy Code code as follows:
http://domain name/project name/Module name/method name/Key 1/value 1/Key 2/value 2
4. Compatibility mode
Copy Code code as follows:
http://domain name/project name/entry file? s= Module name/method name/Key 1/value 1/Key 2/value 2
How to modify/change in PathInfo address-in home/conf/config.php
Copy Code code as follows:
' Url_pathinfo_depr ' => '-',//Modify the Rul separator, put the Address bar parameter part/replace: http://domain name/project name/Entry file/Module name-method name-Key 1-Key value 2
Open Call mode in index.php in order to not allow file caching to affect development in the back-generation mode
Copy Code code as follows:
Define (' App_debug ', ture); If set to Ture do not cache files, false caches files
Rewrite mode opening method
Find Rewrite_module MODULES/MOD_REWRITE.SL in httpd.conf to remove the reboot service and create a new one under the entry file. htaccess.php, rewrite file is to remove the meaning of index.php:
Copy Code code as follows:
Rewriteengine on
Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]
More interested in thinkphp related content readers can view the site topics: "thinkphp Introductory Course", "thinkphp Template Operation Skills Summary", "thinkphp Common Methods Summary", "Smarty Template Introductory Course" and "PHP template technology Summary."
I hope this article will help you with the PHP program design based on thinkphp framework.