phpGrace自定义路由设置

作者: samool    分类: Technology    发布时间: 11-22 21:43    浏览次数:     无留言

在入口页开启路由配置

<?php
define('PG_ROUTE', true);//在框架核心文件引用前定义
include 'phpGrace/phpGrace.php';

在分组目录内找到 router.php 编写路由规则

如:

return array(
    'about' => array('index', 'about', array(120, 'grace')),
    'other' => array('index', 'other')
);

路由: 'about' => array('index', 'about', array(120, 'grace'))
代表:/about 会访问 index 控制器内的 about 方法 并携带 参数 120和 grace (保存在 $this->gets) 。
路由: 'other' => array('index', 'other')
代表:/other 会访问 index 控制器内的 other 方法。