Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从Symfony2中的细枝模板接收参数_Php_Templates_Symfony_Arguments_Twig - Fatal编程技术网

Php 从Symfony2中的细枝模板接收参数

Php 从Symfony2中的细枝模板接收参数,php,templates,symfony,arguments,twig,Php,Templates,Symfony,Arguments,Twig,我正在开发一个应用程序,使用Symfony2和Twig作为模板。我想知道的是如何从控制器中呈现的细枝模板接收控制器中的参数。该参数将具有HTML标记属性的值。此值将分配给HTML标记上的onClick事件中提到的参数。谢谢 您可以通过以下方式实现: {% render 'YourBundle:YourController:yourAction' with { 'yourVariableName': variableValue } %} 其中,variablename与操作所期望的变量相同

我正在开发一个应用程序,使用Symfony2和Twig作为模板。我想知道的是如何从控制器中呈现的细枝模板接收控制器中的参数。该参数将具有HTML标记属性的值。此值将分配给HTML标记上的onClick事件中提到的参数。谢谢

您可以通过以下方式实现:

{% render 'YourBundle:YourController:yourAction' with { 'yourVariableName': variableValue } %}
其中,variablename与操作所期望的变量相同