在 Zend Framework 2 中执行以下操作是否有更好的解决方案:
我需要这两个 URL 执行一项操作 - help/section/5 和 help/section.php?id=5
我认为这种方式太复杂了:
'helpSection' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/help/section/:id',
'defaults' => array(
'controller' => 'Application\Controller\Help',
'action' => 'section',
),
),
),
'helpSection2' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/help/section.php',
'defaults' => array(
'controller' => 'Application\Controller\Help',
'action' => 'section',
),
),
'child_routes' => array(
'query' => array(
'type' => 'Zend\Mvc\Router\Http\Query',
'options' => array(
'defaults' => array(
'id' => ':id'
)
)
),
),
),