有2个参数的symfony重定向 [英] symfony redirect with 2 parameters

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

问题描述

我如何重定向到另一个传递2个或更多参数的动作?这段代码:

how can i redirect to another action passing 2 or more parameters? this code:

$this->redirect('input/new?year=' . $year . '&month=' . $month);

URL的结果:

http://.../input?year=2009&month=9

推荐答案

好吧,那是正常的,重定向"重定向到绝对URL.您可以这样做:

Well, that's normal, "redirect" redirect to an absolute URL. You can do that:

$this->redirect($this->generateUrl('default', array('module' => 'input',
'action' => 'new', 'year' => $year, 'month' => $month)));

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

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