开发者

Zend_Router, routing to indexController / forward when parameter provided

开发者 https://www.devze.com 2022-12-12 06:43 出处:网络
is there any way to tell the Zend Framework Router: \" if www.domain.com/test \" is ca开发者_如何学运维lled

is there any way to tell the Zend Framework Router:

  • " if www.domain.com/test " is ca开发者_如何学运维lled forward to indexController - forwardAction and recieve the parameter.
  • " if www.domain.com" is called show indexController / indexAction

??


Set this function up into your bootstrap file or wherever you store your rutes:

protected function _initRouter()
{
  $this->bootstrap('frontController');
  $front = $this->getResource('frontController');
  $router = $front->getRouter();

  $router->addRoute('testToForward',
                      new Zend_Controller_Router_Route(
                          ':parameter',
                          array(
                              'controller' => 'index',
                              'action'     => 'forward',
}

Edit: This way the passed parameter will be passed as 'parameter' to the forward controller. The second route is provided by default.

0

精彩评论

暂无评论...
验证码 换一张
取 消