简体   繁体   English

从Twig到控制器动作的Symfony2 POST值

[英]Symfony2 POST value from Twig to controller action

I'm new in Symfony2.I want to post a value from twig to controller. 我是Symfony2的新手。我想将一个值从嫩枝发布到控制器。 I know how to pass values through url. 我知道如何通过url传递值。 But i want How to post a data from twig to a controller action without passing that values to url? 但是我想要如何将数据从树枝发布到控制器操作而不将值传递给url?

This is not a limitation of symfony, but the http protocol: you can pass values using either GET or POST parameters. 这不是symfony的限制,而是http协议:您可以使用GET或POST参数传递值。 GET valuas are passed by simple urls, for post you need to use forms or javascript. GET valuas通过简单的URL传递,对于帖子,您需要使用表格或javascript。

It is only a symfony2 related question if you want to embedd another controller in your view - for this, see the documentation 如果要在视图中嵌入另一个控制器,这只是与symfony2相关的问题-有关此信息, 请参见文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM