小编Dar*_*n20的帖子

如何在codeigniter钩子中检索第三个uri段

我正在编写一个自定义的post_controller钩子.我们知道,codeigniter uri结构是这样的:

example.com/class/function/id/
Run Code Online (Sandbox Code Playgroud)

和我的代码:

function hook_acl()
{
    global $RTR;
    global $CI;

    $controller = $RTR->class; // the class part in uri
    $method = $RTR->method; // the function part in uri
    $id = ? // how to parse this?

    // other codes omitted for brevity
}
Run Code Online (Sandbox Code Playgroud)

我浏览了核心的Router.php文件,这让我很困惑.

谢谢.

php hook codeigniter codeigniter-2 codeigniter-hooks

6
推荐指数
1
解决办法
3206
查看次数