自定义路由


如需使用路由,需在入口页开启路由配置

支持使用路由但不建议大家使用比较复杂的路由规则,避免影响性能

				
<?php

define('Z_ROUTE', true); //开启路由配置
include 'Mb/Mb.php';
				
			

在框架核心目录内找到 router.php 编写路由规则

如:

				
<?php 
return [
	'tools'=>['index','tools'],
	'test'=>['index','test',['query','202212191549021','1671436223']]
];
				
			

路由解析

路由: 'tools' => ['index','tools']
代表:/tools 会访问 index 控制器内的 tools 方法。

路由: 'test'=>['index','test',['query','202212191549021','1671436223']]
代表:/test 会访问 index 控制器内的 test 方法,并携带 参数 query、202212191549021、1671436223等参数 (保存在 $this->gets) 。