: This article mainly introduces the ThinkPHP routing mechanism. if you are interested in the PHP Tutorial, refer to it. This example describes the ThinkPHP routing mechanism. We will share this with you for your reference. The details are as follows:
ThinkPHP supports URL routing. to enable routing, set ROUTER_ON to true. After the routing function is enabled, the system automatically performs routing Detection. if a route name that matches the current URL is found in the routing definition, route resolution and redirection are performed. The routing function must define the routing definition file, which is located under the configuration Directory of the project and named routes. php.
Definition format:
Return Array ('routename' => array ('Module name', 'Operation name', 'parameter define', 'additional parameters'), // regular routing );
For example, we have enabled the routing function and defined the following routing rule:
'Blog '=> array ('blog', 'index', 'Year, month, Day', 'userid = 1 & status = 1 ')
So we are executing
The code is as follows:
/AppName/blog/2007/9/15 "> http :// /AppName/blog/2007/9/15
The index operation of the Blog module will be executed, and the following parameters/2007/9/15/will be parsed by year/month/day in sequence, and the userId = 1 and status = 1 parameters are implicitly passed in.