我正在尝试在 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 为空。我的错误可能是什么?