Router Setup Tutorial: PHP Framework queryphp Tutorial: Getting Started Eight by jump

Source: Internet
Author: User
Tags array auth php file php framework

Route description
Path_info Way
Testframework.php?router=default&action=index
Testframework.php/default/index
You can use Apache overrides to remove testframework.php files
You can set routing rules yourself
C ("router")->rulemaps ("Login", '/login/:id ', Array (' controller ' => ' auth ', ' action ' => ' login '));
Then you'll have a testframework.php/login/5555.
This can be done using the $_get[' ID '] to get 5555;
' Controller ' => ' auth ', ' action ' => ' login '
is the controller and method
Other settings can add your own defined routing rules:
C ("router")->rulemaps (' logout ', '/logout ', Array (' controller ' => ' auth ', ' action ' => ' logout '));
C ("router")->rulemaps (' Signup ', '/signup ', Array (' controller ' => ' auth ', ' action ' => ' signup '));
C ("router")->rulemaps (' profile ', '/profile/:action ', Array (' controller ' => ' profile ')); Would call controller "profiles with dynamic Method": Action ()
C ("router")->rulemaps (' Users ', '/users/:id ', Array (' controller ' => ' users '), array (' ID ' => ' [\d]{1,8} ')); Define filters for the URL parameters
Support Path_info Mode
Control action under Router directory
/default/index
Invoke the defaultRouter.class.php file under the router directory
Call the index method after getting the class
J () is the index method jump
R () is controlled by
C () is the build class
M () is a database class model
P () is the load path function this article links http://www.cxybl.com/html/wlbc/Php/20130326/37399.html

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.