Introduction to thinkphp routing mechanism, thinkphp routing mechanism _php Tutorial

Source: Internet
Author: User
Tags php template smarty template

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.