Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
テンプレートに Symfony2 と Twig を使用してアプリケーションを開発しています。私が知りたいのは、コントローラーでレンダリングされた Twig テンプレートからコントローラーで引数を受け取る方法です。引数には、HTML タグ属性の値が含まれます。この値は、HTML タグの onClick イベントで言及された引数に割り当てられます。ありがとう。
これを行うには、次のようにします。
{% render 'YourBundle:YourController:yourAction' with { 'yourVariableName': variableValue } %}
ここで、yourVariableName は yourAction が期待する変数と同じです。