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风格的路线?