我希望:offset
可选。
Router::connect('/some_page/{:offset}/', ...
所以:
Router::connect('/some_page/', ...
Router::connect('/some_page/{:offset}/', ...
两者都走同一条路线。有可能吗?
答案 0 :(得分:1)
首先更改订单:
Router::connect('/some_page/{:offset}/', ...
Router::connect('/some_page/', ...
然后在控制器中检查是否设置了offset
:
isset($this->request->params['offset'])