Configure URL routing in the ThinkPHP Project Group

Source: Internet
Author: User
Tip: We recommend that you explicitly specify the route settings for the default group in the module parameters, although this is not a required default project group route.

The general syntax of route configuration is:




  1. Return array (
  2. 'Routename' => array ('Module name', 'Operation name', 'parameter defining', 'additional parameter '),
  3. );

For the default group, the routing is used in the same way as the original one, that is, the general syntax is used. For example:




  1. Return array (
  2. 'P' => array ('article', 'view', 'id '),
  3. );

Article is the default HOME project
Article module. view is an operation.




  1. Http://www.phplo.com/p/12345
  2. Http://www.phplo.com/Article/view/12345

Non-default project group routing

If a non-default project group uses a route, the project group ID must be added:




  1. Return array (
  2. 'User' => array ('admin. user', 'view', 'id '),
  3. );

This example is the User in the Admin group.
View Operation route of the module.




  1. Http://www.phplo.com/user/12345
  2. Http://www.phplo.com/Admin/User/view/12345

Similarly, the wildcard routing configuration follows the preceding rules.

Tip: We recommend that you explicitly specify the route settings of the default group in the module parameters, although this is not required.

Read more

ThinkPHP
URL routing configuration
ThinkPHP URL access mode

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.