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

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

问题描述

如何重定向到另一个传递 2 个或更多参数的操作?

How can I redirect to another action passing 2 or more parameters?

此代码:

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

网址中的结果:

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天全站免登陆