Introduction to ThinkPHP routing mechanism and thinkphp routing mechanism. ThinkPHP routing mechanism introduction. This article describes the thinkphp routing mechanism. For your reference, ThinkPHP supports URL routing. to enable ThinkPHP's routing mechanism introduction, thinkphp's routing mechanism
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.