phpGrace自定义路由设置

该日志由 samool 发表于 2019-11-22 21:43:00

在入口页开启路由配置

<?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 方法。

该日志标签: php, grace, 路由设置

上一篇: phpGrace核心配置参数
下一篇: phpGrace URL 生成

当前暂无评论 »

添加新评论 »