我想知道是否可以修改请求参数的值。
但我不知道该怎么做。
我尝试
$requestContent = $this->getRequest()->request->get('tactill_customerbundle_customertype');
接下来我使用
$request->request->replace()
但我不知道如何在我的情况下使用这种方法。
谢谢
我想知道是否可以修改请求参数的值。
但我不知道该怎么做。
我尝试
$requestContent = $this->getRequest()->request->get('tactill_customerbundle_customertype');
接下来我使用
$request->request->replace()
但我不知道如何在我的情况下使用这种方法。
谢谢
该replace方法替换了请求中的所有参数,因此您可能不想这样做。
我会改用该set方法 - 所以你可以这样做:
$request->request->set('tactill_customerbundle_customertype', $newValue)
您可以在 Symfony2 文档 ( http://api.symfony.com/2.0/ ) 中阅读更多内容 - 您正在寻找Symfony\Component\HttpFoundation\Request(这是$request变量),然后Symfony\Component\HttpFoundation\ParameterBag在您调用该request()方法时返回 a 。