【问题标题】:Zend Framework 2 (ZF2) - $this->url()->toRoute()Zend 框架 2 (ZF2) - $this->url()->toRoute()
【发布时间】:2013-05-10 20:23:04
【问题描述】:

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

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

我的错误是什么?

Tks

【问题讨论】:

  • 更像IndexController#helloAction()
  • 能否请您发布其余的路线配置,以便我们了解一些背景信息,atm 不清楚您发布的 sn-p 到底适合哪里。

标签: php zend-framework zend-framework2


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2012-10-09
    • 1970-01-01
    • 1970-01-01
    • 2015-06-05
    • 2013-01-31
    • 1970-01-01
    • 1970-01-01
    • 2013-05-04
    • 1970-01-01
    相关资源
    最近更新 更多