thinkphp four kinds of URL access methods, Thinkphpurl
In this paper, four kinds of URL access methods of thinkphp are analyzed. Share to everyone for your reference. The specific analysis is as follows:
First, what is MVC
The thinkphp MVC pattern is very flexible, even if only three and one can be run.
M-model writing Model classes to manipulate data
V-view Writing HTML files, page rendering
C-controller Writing class files (UserAction.class.php)
Second, thinkphp MVC features (simple to understand)
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, the URL of 4 ways to access (this is the focus!!) )
1.PATHINFO Mode --focus on the back use very much, if you want to pass multiple parameters can use the key 1/value 1/Key 2/value 2 method
The copy Code code is as follows://domain/project/portal File/Module name/method name/Key 1/value 1/Key 2/value 2
2. Normal mode is also known as rewrite mode
The copy Code code is as follows://domain/project name/Portal file? m= Module name &a= method name & key 1= value 1& key 2= value 2
3.REWRITE Rewrite mode , remove the entry file to facilitate SEO optimization
The copy Code code is as follows://Domain name/project name/Module name/method name/Key 1/value 1/Key 2/value 2
4. Compatibility mode
The copy Code code is as follows://domain/project name/Portal 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 the code as follows: ' Url_pathinfo_depr ' + '-',//Modify the delimiter of the Rul, put the parameter part of the address bar/change to:///Name/project name/Entry file/Module name-method name-key value 1-key value 2
Turn on Call mode in index.php in order to not allow file cache to affect development in post-production mode
Copy the Code code as follows: Define (' App_debug ', ture);//If set to Ture do not cache files, false to cache files
Rewrite mode Open method
Find Rewrite_module MODULES/MOD_REWRITE.SL in httpd.conf to remove the restart service, create a new. htaccess.php in the portal file, rewrite the file is to remove the meaning of index.php:
Copy the Code code as follows: Rewriteengine on
Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule ^ (. *) $ index.php/$1 [qsa,pt,l]
It is hoped that this article will be helpful to everyone's thinkphp framework design.
http://www.bkjia.com/PHPjc/919265.html www.bkjia.com true http://www.bkjia.com/PHPjc/919265.html techarticle thinkphp Four kinds of URL access methods in detail, Thinkphpurl This article analyzes the thinkphp four kinds of URL access methods. Share to everyone for your reference. The specific analysis is as follows: First, what is MVC ...