Custom routing rules in the CI framework, ci framework custom routing _ PHP Tutorial

Source: Internet
Author: User
Custom routing rules in the CI framework and custom routing in the ci framework. Custom routing rules in the CI framework. in the ci framework, a URL corresponds to the class in the controller and the method in the class, for example, www. custom routing rules in the t CI framework and custom routing in the ci framework

In the CI framework, a URL corresponds to the class in the controller and the method in the class, for example:

www.test.com/user/info/zhaoyingnan

User corresponds to the user class in the controller, info corresponds to the info method in the user class, and zhaoyingnan is the passed parameter.

If I do not want to use the URL www.test.com/user/info/zhaoyingnan,

Instead, it is changed to www.test.com/member/zhaoyingnan,

In this case, you need a custom routing rule,

When the URL is www.test.com/member/zhaoyingnan, the actual request is www.test.com/user/info/zhaoyingnan.

Here, the actual expression I recommend is not mentioned in other methods:

Application/config/routes. php

2. add the following operations:

/*** @ Author zhaoyingnan * custom routing rule **/$ route ['Member/(\ w + )/? $ '] = 'User/info/$1 ';

Custom routing rules in the http://www.bkjia.com/PHPjc/1060691.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1060691.htmlTechArticleCI framework, ci framework custom routing in the CI framework, a URL and its corresponding controller class and the method in the class is one-to-one correspondence, such as: www. t...

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.