0

我有以下(和独特的)路由规则:

Router::connect(
    '/*',
    array(
        'controller' => 'dispatch',
        'action' => 'index'
    )
);

它发送DispatchController::index()响应解析和“重新路由”请求的所有请求,例如动态路由。当我访问/sample-page/debug并进行调试$this->request时,以下是我收到的输出:

object(CakeRequest) {
    params => array(
        'plugin' => null,
        'controller' => 'dispatch',
        'action' => 'index',
        'named' => array(),
        'pass' => array(
            (int) 0 => 'sample-page',
            (int) 1 => 'edit'
        )
    )
    [...]
}

我想从请求中接收正确的值:

object(CakeRequest) {
    params => array(
        'plugin' => null,
        'controller' => 'sample-page',
        'action' => 'edit',
        'named' => array(),
        'pass' => array()
    )
    [...]
}

我试过没有成功:

Router::connect(
    '/:controller/:action/*',
    array(
        'controller' => 'dispatch',
        'action' => 'index'
    )
);
4

0 回答 0