7
我的Zend Framework 2應用程序有一個路由定義,它試圖模仿默認的Zend Framework 1路由。它看起來像:Zend Framework 2 Part Route Assembly
'router' => array(
'routes' => array(
'default' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'wildcard' => array(
'type' => 'wildcard',
),
),
),
),
),
它匹配的路線就好了,但我不能組裝與使用Url
視圖助手任意參數路線。
例如,
$this->url('default', array('controller' => 'test', 'action' => 'test', 'id' => 5));
導致/test/test
代替/test/test/id/5
。
有誰知道如何組裝這樣的部分路線?還是有更好的方式獲得ZF1風格的路線?