Introduction to thinkphp routing mechanism, thinkphp routing mechanism
The example in this paper describes the thinkphp routing mechanism. Share to everyone for your reference, as follows:
Thinkphp supports the URL routing feature, you need to set the router_on parameter to true to enable routing. When routing is turned on, routing detection is performed automatically, and routing resolution and redirection is performed if a route name that matches the current URL is found in the route definition. The routing feature needs to define a route definition file, located under the project's configuration directory, with the file name routes.php
Define the format:
Return Array (' RouteName ' =>array (' module name ', ' Operation name ', ' parameter definition ', ' extra parameter '), //regular route);
For example, we enabled the routing feature and defined one of the following routing rules:
' Blog ' =>array (' blog ', ' Index ', ' year,month,day ', ' Userid=1&status=1 ')
So we're doing
Copy the Code code as follows:/APPNAME/BLOG/2007/9/15 ">http:// /appname/blog/2007/9/15
Will actually perform the Blog module index operation, the following parameter/2007/9/15/will be followed by Year/month/day to parse, and will implicitly pass in Userid=1 and Status=1 two parameters.
More interested in thinkphp related content readers can view this site topic: "thinkphp Introductory Tutorial", "thinkphp Common Methods Summary", "Smarty Template Primer Basic Tutorial" and "PHP template technology Summary."
It is hoped that this article is helpful to the PHP program design based on thinkphp framework.
Articles you may be interested in:
- thinkphp Routing
- thinkphp, ZF2, YAF, laravel framework routing big battle
- URL routing rules and configuration instances for thinkphp
- Overwrite thinkphp's U method so that it is routed under normal paging
- thinkphp routing rules use examples to understand and pseudo-static functionality implementations (Apache overrides)
- An example analysis of MVC development mechanism in thinkphp
- Thinkphp using smarty third-party plug-in method summary
- thinkphp implementation of image upload function
- thinkphp Query Method Summary
- thinkphp namespace Usage Examples
- Example analysis of page usage in thinkphp
http://www.bkjia.com/PHPjc/1113706.html www.bkjia.com true http://www.bkjia.com/PHPjc/1113706.html techarticle Introduction to thinkphp routing mechanism, thinkphp routing mechanism The thinkphp routing mechanism is described in this paper. Share to everyone for reference, as follows: thinkphp support URL routing function, to start ...