Zend 框架 2 重定向 [英] Zend Framework 2 Redirect

查看:33
本文介绍了Zend 框架 2 重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何重定向到另一个模块?

How can I redirect to another module?

return $this->redirect()->toRoute(null, array(
    'module'     => 'othermodule',
    'controller' => 'somecontroller',
    'action'     => 'someaction'
));

这似乎不起作用,有什么想法吗?

This doesn't seem to work, any ideas?

推荐答案

这是我从控制器重定向到另一个路由的方式:

This is how I redirect from my Controller to another Route:

return $this->redirect()->toRoute('dns-search', array(
    'companyid' => $this->params()->fromRoute('companyid')
));

其中 dns-search 是我要重定向到的路由,companyid 是 url 参数.

Where dns-search is the route I want to redirect to and companyid are the url params.

最后URL变成/dns/search/1(例如)

In the end the URL becomes /dns/search/1 (for example)

这篇关于Zend 框架 2 重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆