【发布时间】:2012-08-08 06:16:49
【问题描述】:
我对ZF2非常陌生,不知道如何设置全局路由器。 我知道如何在模块级别设置:
http://packages.zendframework.com/docs/latest/manual/en/user-guide/routing-and-controllers.html 说:
将 URL 映射到特定操作是使用以下路由完成的: 在模块的 module.config.php 文件中定义。我们将添加一条路线 对于我们的专辑操作。这是更新后的配置文件 代码注释。
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
有没有办法为整个应用程序配置默认行为?或者我必须在每个模块中进行配置? config/application.config.php 将是一个合乎逻辑的地方。它在某处有记录吗?
【问题讨论】: