【问题标题】:I want to create dynamic routing for all the modules in zend framework 2.3?我想为 zend 框架 2.3 中的所有模块创建动态路由?
【发布时间】:2014-10-09 05:17:56
【问题描述】:

我是 Zend Framework 2.3 的新手,让我们检查一下我在 Zend Framework 2.3 中的应用程序中有多个模块,但我不想为要创建动态路由的路由创建单独的模块配置文件,那么我该如何执行它请帮忙。

【问题讨论】:

标签: zend-framework zend-framework2 zend-form zend-studio


【解决方案1】:

全球路线就是你想要的:

'router' => array(
        'routes' => array(
            'home' => array(
                'type' => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'Application\Controller\Index',
                    ),
                ),
            ),
            'pages' => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'       => '/:module/[:controller[/:action[/:id]]]',
                    'constraints' => array(

                        'module' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'         => '[a-zA-Z0-9_-]*'
                    ),


                ),
            ), 

      ), 
 ),

【讨论】:

  • Zf2 应用程序一旦被引导就没有模块的概念。
  • @Xerkus 无关紧要,只要控制器具有唯一的名称
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-13
  • 1970-01-01
  • 1970-01-01
  • 2012-04-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多