我的帖子控制器中有以下方法:
public function index( $filter = null )
{
debug($filter); exit;
}
如果我访问以下 URL:/posts/index/filter:test
它将返回 null 但如果我使用/posts/index/test
它将返回 test...
我的印象是 Cake 默认将传递的参数视为命名?
我尝试使用以下路线解决此问题:
Router::connect('/test', array('controller'=>'posts','action'=>'index','filter'=>'test'));
但它仍然返回为空!好像过滤器没有传递给方法......
我该如何解决?