2
我傳遞VAR argurmrnt到控制器這樣如何通過Symfony將參數傳遞給控制器?
return $this->redirect($this->generateUrl('user_profile', array('var' => $profile->getId())));
這是我的控制器
/**
* @Route("/profile", name="user_profile")
* @Template()
*/
public function ProfileAction($var)
{
$em = $this->getDoctrine()->getEntityManager();
但我不斷收到錯誤
控制器「XXXX \控制器\ UserController中:: ProfileAction ()「需要 ,您提供了」$ var「參數的值(因爲沒有 默認值或者因爲有在此之後的非可選參數 之一)。