Home > php教程 > php手册 > 路由器设置教程:PHP框架queryphp教程:入门八 路由跳转

路由器设置教程:PHP框架queryphp教程:入门八 路由跳转

WBOY
Release: 2016-06-21 08:50:12
Original
1374 people have browsed it

路由说明
path_info方式
testframework.php?router=default&action=index
testframework.php/default/index
可以使用apache重写 去掉testframework.php文件
可以自己设置路由规则
C("router")->ruleMaps("login",'/login/:id', array('controller' => 'auth', 'action' => 'login'));
那么会配匹testframework.php/login/5555
这样可以使用$_GET['id']得到5555;
'controller' => 'auth', 'action' => 'login'
是控制器和方法
其它设置 可以添加自己定义的路由规则:
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
支持path_info方式
控制动作在router目录下面
/default/index
调用router目录下面defaultRouter.class.php文件
取得类后调用index方式
J()是index方法跳转
R()是由控制
C()是生成类
M()是数据库类模型
P()是加载路径函数 本文链接http://www.cxybl.com/html/wlbc/Php/20130326/37399.html



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template