我需要根据搜索参数设置路由(我使用CakeDC搜索插件)
网址应如下所示:/apartments/studio-apartments
而不是:/apartments/propertytype_id:1
我已经尝试过添加这样的路线:
Router::connect('/apartments/studio-apartments', array('controller'=>'apartments', 'action'=>'index'), array('pass'=>array('propertytype_id:1')));
或
Router::connect('/apartments/studio-apartments', array('controller' => 'apartments', 'action' => 'index', 'propertytype_id:1'));
来自Cake book的
答案 0 :(得分:1)
在routes.php中尝试这个:
Router::connect('/apartments/studio-apartments',
array('controller' => 'apartments','action' => 'index'),
array('propertytype_id' => '[0-9\-]+')
);