这里的顶级路由器能工作。/property是一个不终止并在子路由上获取GET操作的文字路由。在下面,我有一个段路由,和它的父路径一样,它不会终止并在子路由上获取GET操作。它应该只响应/property/12上的GET请求
我在那里路由时发现了一个没有发现的错误。
'router' => array(
'routes' => array(
'property' => array(
'type' => 'Literal',
'options' => array(
'route' => '/property',
),
'may_terminate' => false,
'child_routes' => array(
'get' => array(
'type' => 'method',
'options' => array(
'verb' => 'GET',
'defaults' => array(
'controller' => 'Property\Controller\Rest',
'action' => 'get',
),
),
),
'by_id' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:propertyId]',
'may_terminate' => false,
'child_routes' => array(
'get_by_id' => array(
'type' => 'method',
'options' => array(
'verb' => 'GET',
'defaults' => array(
'controller' => 'Property\Controller\Rest',
'action' => 'getById',
),
),
),
)
),
),发布于 2015-07-28 08:50:05
数组无效。'may_terminate'不应该在'options'内部。不确定这是否是导致所有问题的原因,但请尝试更新并查看是否已解决:
'by_id' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:propertyId]'
),
'may_terminate' => false,
'child_routes' => array(
'get_by_id' => array(
'type' => 'method',
'options' => array(
'verb' => 'GET',
'defaults' => array(
'controller' => 'Property\Controller\Rest',
'action' => 'getById'
)
)
)
)
),https://stackoverflow.com/questions/31667465
复制相似问题