2013-01-24 58 views
0

我有可能的子路由的多个路由。路由按预期工作,但是我想全局(在所有路由上)允许某些(或全部)查询参数。全局允许查询参数

例如http://example.com/route/match?utm_source=testhttp://example.com/route?utm_source=test ...应该工作,有没有办法让我的所有路线,或者我应该为每条路线添加一个查询子路由?

当前路线的例子:

'category' => array(
    'type' => 'Segment', 
    'options' => array(
     'route' => '/:category[/]', 
     'constraints' => array(
      'category' => '[a-z][a-z0-9-]*', 
     ), 
     'defaults' => array(
      'controller' => 'Category', 
      'action'  => 'index' 
     ), 
    ), 
    'may_terminate' => true, 
    'child_routes' => array(
     'subcategory' => array(
      'type' => 'Segment', 
      'options' => array(
      'route' => ':subcategory[/]', 
      'constraints' => array(
       'subcategory' => '[a-z][a-z0-9-]*', 
      ), 
      'defaults' => array(
       'controller' => 'Category', 
       'action'  => 'subcategory' 
      ), 
     ), 
    ), 
), 

编辑:
我刚刚注意到,如果路由没有定义的child_routes,查询参数是允许的。

回答

0

无论查询路由如何,查询参数都是允许的。它仅仅意味着组装,这在ZF 2.1.4思想中已被弃用。