【发布时间】:2012-09-18 10:28:07
【问题描述】:
我正在尝试在 CakePHP 中为我的控制器进行路由。
我的控制器名为 UserGames。 默认 CakePHP 排序代码:
<?php echo $this->Paginator->sort('price'); ?>
默认情况下,排序链接如下所示:userGames/index/sort:name/direction:asc
我添加了以下路由规则:
Router::connect('/games', array('controller' => 'UserGames', 'action' => 'index'));
Router::connect('/games/:sort/:direction', array('controller' => 'UserGames'));
使用这些排序链接会生成如下 URL:games/name/asc
排序不能以这种方式工作,并且 $this->PassedArgs 是空的。我的错误是什么?
【问题讨论】: