In the CI framework, a URL and the classes in its corresponding controller and the methods in the class are one by one corresponding, such as:
Www.test.com/user/info/zhaoyingnan
Where user corresponds to the user class in the controller, and info corresponds to the info method in the user class, Zhaoyingnan is the passed parameter
If I don't want to use the Www.test.com/user/info/zhaoyingnan URL,
Instead of changing to Www.test.com/member/zhaoyingnan,
You need a custom routing rule at this point,
When the URL address is Www.test.com/member/zhaoyingnan, the actual request should be Www.test.com/user/info/zhaoyingnan
Here, I recommend the use of the expression, other methods do not mention:
- Locate the file that configures the routing rule first
application/config/routes.php
2. Add the following actions
/* * * @author Zhaoyingnan * Custom Routing rules **/$route[' member/(\w+)/?$ '] = ' user/info/$1 ';
The above describes the CI framework of the custom routing rules, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.