【发布时间】:2015-09-03 04:06:34
【问题描述】:
我想配置我的 Zf2 应用程序,使多个字符串路由到同一个控制器。例如 www.mysite.com/this 和 www.mysite.com/ 都路由到同一个控制器,并且可以使用 $this->params 捕获这个和那个。我将如何完成这样的事情?我需要 2 个单独的路由声明吗?
'directory' => [
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => [
'route' => '/string1 || /string2 || /string3',
'defaults' => [
'controller' => 'Application\Controller\MyController',
'action' => 'index'
],
],
]
【问题讨论】:
-
像你提到的那样制作两条单独的路线
标签: zend-framework routing routes zend-framework2 url-routing