symfony redirect with 2 parameters

后端 未结 6 1001
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 07:07

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

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


        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 07:40

    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)));
    

提交回复
热议问题