CakePHP路由 - 搜索parms

时间:2011-10-10 01:49:25

标签: cakephp routing

我需要根据搜索参数设置路由(我使用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的

that one

1 个答案:

答案 0 :(得分:1)

在routes.php中尝试这个:

Router::connect('/apartments/studio-apartments',
    array('controller' => 'apartments','action' => 'index'),
    array('propertytype_id' => '[0-9\-]+')
);