【TP3.2】路由匹配和规则
TP3.2框架的路由匹配和规则处理:
包括:静态路由,动态路由,多参数路由、正则路由
<?php return array( //'配置项'=>'配置值' /* * 路由开启和匹配。首先开启路由匹配,然后根据相应的路由规则进行匹配 * 1、静态路由 * 2、动态路由 * 3、动静态结合路由 * 4、正则路由 */ 'URL_ROUTER_ON' => true, //开启路由 'URL_ROUTE_RULES' => array( //定义路由规则 //路由规则 //指向url匹配地址 'News/top' => 'news/index?type=top', //静态路由(死的),指向Admin/news/index?type=top 'News/:id\d$' => 'News/read', //动态路由,指向Admin/News/read?id=:id //$后面再加参数是无效的 'News/:name' => 'News/read', //动态路由,指向Admin/News/read?name=:name,注意这里的name参数一定要和控制器接受的name参数一致 'News/:year\d/:month\d' => 'News/archive', '/^News\/(\d{4})\/(\d{2})$/' => 'News/archive?year=:1&month=:2',//正则路由,指向Admin/News/archive?year=:1&month=:2 ), );