我有以下(和唯一的)路由规则:
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'
)
);