我访问twig实例,并像这样呈现模板:
return $this->template->render('login.html', array(
'name' => 'John Smith',
'age' => 32,
'location' => 'Egypt'
));
这是事物的模板方面
Hello, my name is {{ name }}, my age is {{ age }}, and my location is {{ location }}.
目前打印出来
Hello, my name is , my age is , and my location is .
应打印
Hello, my name is John Smith, my age is 32, and my location is Egypt.
答案 0 :(得分:-1)
检查Symfony docs Rendering Templates
return $this->render('login.html', array(
'name' => 'John Smith',
'age' => 32,
'location' => 'Egypt'
));