Zend Framework 2 (ZF2) - $this->url()->toRoute()



功能return $ this-> redirect() ->toRoute('home');重定向到我的主页。函数return $ this-> redirect() ->toRoute('home', array('controller' => 'index', 'action' => 'hello'));必须重定向到主页/索引/hello,但重定向只是主页。

'type' => 'segment',
                'options' => array(
                    'route' => '[/:controller][/:action][/:id]'

我写错了什么

谢谢

您是否将index控制器和hello动作定义为默认值?然后它们不会显示在URL中,但会显示正确的页面。

最新更新