## 開啟路由
1. 首先要先在配置文件中開啟路由功能:'ROUTE_ON'=>true,
2. 在配置文件中定義路由規則的分隔符:'ROUTE_DELIMIT'=>'-',
## 規則定義:
**1. 在入口文件中定義路由規則**
<?php
define('IN',str_replace('\\','/',dirname(__FILE__)) . '/');
define('APP_PATH','home');
define('DEBUG',1);
require('../core/core.php');
/*在此位置定義路由規則*/
route(['u'=>['user','index','userid']]);
route(['my'=>['index','my','id']]);
route(['t'=>['user','info','uid','name','age','sex']]);
/*定義路由規則結束*/
\z\z::start();
**2. 單獨配置路由規則文件**
需要在 應用目錄/common/ 目錄下增加 route.php 文件
<?php
return array(
['u'=>['user','index','userid']],
['my'=>['index','my','id']],
['t'=>['user','info','uid','name','age','sex']]
);
>[danger]**規則解釋**
http://xxx.com/index.php/u-12 將被路由到 http://xxx.com/index.php?c=user&a=index&userid=12
http://xxx.com/index.php/my-2 將被路由到 http://xxx.com/index.php?c=index&a=my&id=2
http://xxx.com/index.php/t-1-2-3-4 將被路由到 http://xxx.com/index.php?c=user&a=info&uid=1&name=2&age=3&sex=4
url解析先按照規則中的鍵名(u , my , t)匹配
鍵值數組中的**前兩個值**被依次解析為 **控制器名** 和 **操作名**
剩余的值被解析為GET參數名
url中的 -1-2-3-4 將 **按順序** 對應 GET參數值