【发布时间】:2018-12-28 11:55:47
【问题描述】:
我尝试在参数中传递我的用户 ID,因为我想在其他函数中使用它来链接它们,但不知道为什么这不起作用(我认为我做错了,很容易回答谢谢 :)
return $this->redirect('/profile/new/', array(
'id' => $user->getId(),
));
我的接收器:
/**
* Creates a new profile entity.
*
* @Route("/new/{id}", name="profile_new")
*/
public function newProfileAction(Request $request)
{
例如,当我执行/profile/new/8 时,它可以工作!但是当我点击按钮提交时,不使用 id 重定向......(当然路线很好,当我这样做时 - 它有效:
return $this->redirect('/profile/new');
我的接收器(当它工作时):
/**
* Creates a new profile entity.
*
* @Route("/new", name="profile_new")
*/
public function newProfileAction(Request $request)
{
【问题讨论】:
-
你能添加更多代码吗?
-
你需要什么?
标签: symfony redirect parameters routes