如何使用一个路由器规则允许该控制器内的所有子操作?例如以下:
visit: site/login - works only
site/login/forgetpassword - does not work
site/login/remmeberme - does not work
例子:
$router = $e->getApplication()->getServiceManager()->get('router');
$route = Http\Literal::factory(array(
'route' => '/login',
'defaults' => array(
'controller' => 'Application\Controller\Login',
'action' => 'index'
),
));
$router->addRoute('login', $route, null);
跟进:
我怎样才能让它 /login 和 /login/anything 工作?
$route = Http\Segment::factory(array(
'route' => '/login[/:action]',
'defaults' => array(
'controller' => 'Application\Controller\Login',
'action' => 'index'
),
));
$router->addRoute('login', $route, null);