我正在努力解决这个问题,无法克服它。
我想要实现的是这样的路线:/rolepermission[/:roleid]/permissions[/:permissionid][/action/:action]
目前我想出了这样的事情:
'rolepermission' => array(
'type' => 'literal',
'options' => array(
'route' => '/rolepermission',
'constraints' => array(),
'defaults' => array(
'controller' => 'My\Controller\RolePermission',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'rolepermissionroleid' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:roleid]',
'constraints' => array(
'roleid' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'action' => 'detail',
),
),
'may_terminate' => true,
'child_routes' => array(
'rolepermissionpermissions' => array(
'type' => 'literal',
'options' => array(
'route' => '/permissions',
'constraints' => array(),
'defaults' => array(
'action' => 'index'
),
),
'may_terminate' => true,
'child_routes' => array(
'rolepermissionpermissionid' => array(
'type' => 'segment',
'options' => array(
'route' => '/[:permissionid]',
'constraints' => array(
'permissionid' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
'may_terminate' => true,
'child_routes' => array(
'rolepermissionaction' => array(
'type' => 'segment',
'options' => array(
'route' => '/action/[:action]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
'action' => 'index'
),
),
'may_terminate' => false,
'child_routes' => array(),
),
),
),
),
),
),
),
),
),
当路由到 /rolepermission/permissions 时,我经常得到“权限”来代替 :roleid。由于没有通过角色标识,我希望这里没有任何东西可以替代。我究竟做错了什么?
提前谢谢,干杯