我在设置 child_routes 时遇到了一些麻烦。除非我将它们分开,否则它们不起作用,尽管最终结果应该是相同的!:
这就是我想要实现的目标:
'router' => array(
'routes' => array(
'app' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '[/:info]/app',
'defaults' => array(
'__NAMESPACE__' => 'X\App',
'controller' => 'Index',
'action' => 'index',
),
'may_terminate' => true,
'child_routes' => array(
'example' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/example[:/data]',
'defaults' => array(
'action' => 'example',
),
),
),
),
),
),
),
但它只能这样工作:
'router' => array(
'routes' => array(
'app' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '[/:info]/app',
'defaults' => array(
'__NAMESPACE__' => 'X\App',
'controller' => 'Index',
'action' => 'index',
),
),
),
'app.example' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '[/:info]/app/example[/:data]',
'defaults' => array(
'__NAMESPACE__' => 'X\App',
'controller' => 'Index',
'action' => 'example',
),
),
),
),
..任何人都知道我可能做错了什么..?