PHP framework queryphp Tutorial: Entry 8 route jump instructions path_info testframework. php? Routerdefault & amp; actionindextestframework. phpdefaultindex? You can use apache to rewrite and remove the testframework. PHP file. you can set routing rules by yourself. c php framework queryphp Tutorial: Entry 8 route jump
Route description
Path_info mode
Testframework. php? Router = default & action = index
Testframework. php/default/index?
You can use apache to rewrite and remove the testframework. php file.
You can set routing rules yourself.
C ("router")-> ruleMaps ("login", '/login/: ID', array ('controller' => 'auth ', 'action' => 'login '));
Testframework. php/login/5555
In this way, you can use $ _ GET ['id'] to GET 5555;
'Controller' => 'auth', 'Action' => 'login'
Yes controller and method
You can add custom routing rules for other settings:
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 ')); // will call controller "Profile" 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
The control action is under the router directory.
/Default/index
Call the defaultRouter. class. php file under the router directory.
Call the index method after obtaining the class
- J () is the index method jump
- R () is controlled
- C () is the generation class
- M () is a database model?
- P () is the load path function.