2013-01-24 39 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思想中已被棄用。