Routing 更多zend framework2路由问题

Routing 更多zend framework2路由问题,routing,zend-framework2,Routing,Zend Framework2,我设法弄明白了在zf2中路由的基本原理。我现在遇到了一个小绊脚石,因为我需要在我的客户控制器中选择不同的方法。以下是我基于社区答案的尝试: // Customers Routing 'customers' => array( 'type' => 'Segment', 'options' => array( 'route' => '/api/

我设法弄明白了在zf2中路由的基本原理。我现在遇到了一个小绊脚石,因为我需要在我的客户控制器中选择不同的方法。以下是我基于社区答案的尝试:

 // Customers Routing
            'customers' => array(
            'type'    => 'Segment',
                'options' => array(

                    'route'   => '/api/customers[/]',
                    'defaults' => array(
                        '__NAMESPACE__' => 'Application\Controller',
                        'controller'    => 'Customers',
                        'action'        => 'index'
                    ),
                ),

                'may_terminate' => true,
                'child_routes' => array (
                    'add-product' => array(
                        'type' => 'method',
                        'options' => array(
                            'verb' => 'get',
                        ),
                        'child_routes' => array(
                            // actual route is a child of the method
                            'form' => array(
                                'may_terminate' => true,
                                'type' => 'Segment',
                                'options' => array(
                                    'route' => '/api/customers/[:id][/]',
                                    'defaults' => array(
                                    'controller' => 'Customers',
                                    'action' => 'all',
                                    ),
                                ),
                            ),
                        ),
                    ),
                ),
            ),

你的问题在哪里


在本例中,您可以通过url
/api/customers/api/customers/[:id]
使用表单child\u路由,因为家长路由是预先设置的。

Ahhh这就是我需要知道的,我不确定是否将子路由放置在了正确的位置,因为我认为它更像是一个最佳匹配系统。谢谢