你好,我有一个Zf3项目。
我有多个具有相同控制器名称和别名的模块
我的目标
localhost/cart/index
localhost/user/index
但是
localhost/user/index
始终转到模块购物车indexController 如何解决这个问题
1.module购物车
'controllers' => [
Controller\IndexController::class => InvokableFactory::class],
'aliases'=>[
'index' => Controller\IndexController::class ,
],
],
'router' => [
'routes' => [
'cart' => [
'type' => Segment::class,
'options' => [
'route' => '/cart[/:controller[/:action]]',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
]
]
]
2.module用户
'controllers' => [
Controller\IndexController::class => InvokableFactory::class],
'aliases'=>[
'index' => Controller\IndexController::class ,
],
],
'router' => [
'routes' => [
'user' => [
'type' => Segment::class,
'options' => [
'route' => '/user[/:controller[/:action]]',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
]
]
]