【发布时间】:2012-03-15 14:22:06
【问题描述】:
$this->render 和 $this->redirect 有什么区别。有没有一种方法可以像使用 $this->redirect 一样使用 $this->render 传递参数
return $this->render('MedicineUserBundle:User:home.html.twig', array(
'info' => $all,));
我可以这样做吗:-
return $this->redirect($this->generateUrl('MedicineUserBundle_login', array(
'info' => $all,)));
或者有没有其他方法可以通过 $this->redirect 将值传递到我的模板树枝文件。
还有一个问题,我如何使用$this->redirect 更改网址,例如,如果我不必将任何值传递给我的模板文件,我可以按照上面提到的那样执行,渲染会将我带到像 localhost 这样的页面/myproject/home 但$->this->redirect 将执行控制器,但 url 将与 localhost/myproject/ 相同。无论如何我可以使用重定向重定向到另一个网址
【问题讨论】: