This paper summarizes the two modes of pathinfo in thinkphp, four path access modes and URL rewriting related knowledge, and shares them for easy inquiry and reference. The specific summary is as follows:
1, PathInfo
Access the test method below the module IndexAction.class.php
Http://localhost/index.php?m=Index&a=test equal to Http://localhost/index.php/Index/test
2, four kinds of path access mode
At the bottom of the Config directory to make changes to the value of the Url_model, respectively, expressed as follows:
A value of 0 is called normal mode. such as: http://localhost/index.php?m= module &a= method
A value of 1 is called PathInfo mode. such as: http://localhost/index.php/module/method
A value of 2 is called rewrite rewrite (pseudo static) can write the relevant rewrite rules, or you can use the system for the rewrite rules we provide to hide the index.php, generate: http://localhost/module/method
A value of 3 is called compatibility mode. When the PathInfo mode is not supported on the server, but you are in the previous path access format, all using the PathInfo format. Then it will prompt you that the path format is not correct. Then, you can use the compatibility mode labeled 3 to deal with. His path access is similar to the Http://localhost/index.php?s= module/method
3. URL Rewrite steps:
(1), D:\wamp\wamp\Apache2\conf\httpd.conf Open the Url_rewrite module in the Apache server
(2), allowoverride none change none to all
(3) Ensure that the Url_model is set to 2 in the config.php configuration file
(4), put the. htaccess file in the same level as the entry file
URL rewriting is advantageous for SEO, but it will increase the performance consumption of the server.
I hope this article will help you to thinkphp program design.