0
我想在ZF2中完成一些基本路由,但我遇到了一些问题。ZF2儿童路线问题
是给我找麻烦的部分是这样的:
'parent-categories' => array(
'type' => 'literal',
'options' => array(
'route' => '/kategorier/',
'defaults' => array(
'controller' => 'categories',
'action' => 'parent-categories',
),
),
'may_terminate' => true,
'child_routes' => array(
'child-categories' => array(
'type' => 'segment',
'options' => array(
'route' => '/kategorier[/:slug][/:parentCategoryid]/',
'constraints' => array(
'parentCategoryid' => '[0-9]+',
),
'defaults' => array(
'controller' => 'categories',
'action' => 'child-categories',
)
),
),
),
),
原来的“父类”路线工作得很好,没有任何问题。但问题是儿童类别路线没有做任何事情。我有网址:
/kategorier/test-test-test-test-test/1/
但这是从来没有匹配的任何东西。我得到的错误:
The requested URL could not be matched by routing.
如果我带着孩子,类别航线开展“child_routes”部分,它总是捕捉请求,即使网址只有/ kategorier /。任何人都可以看到我在这里做错了吗?
感谢您的建议和修复,完美工作 – shiznatix
了解这些是LIFO。如果你配置了一组子路由,堆栈中的最后一个(匹配的)路由将被触发。 – Saeven