Symfony 修改请求参数的值
我想知道是否可以修改请求参数的值 但我不知道怎么做 我试着用Symfony 修改请求参数的值,symfony,Symfony,我想知道是否可以修改请求参数的值 但我不知道怎么做 我试着用 $requestContent = $this->getRequest()->request->get('tactill_customerbundle_customertype'); 接下来我用 $request->request->replace() 但我不知道如何在我的案例中使用这种方法 感谢使用replace方法替换请求中的所有参数,因此您可能不想这样做 我会使用set方法,因此您可以: $re
$requestContent = $this->getRequest()->request->get('tactill_customerbundle_customertype');
接下来我用
$request->request->replace()
但我不知道如何在我的案例中使用这种方法
感谢使用
replace
方法替换请求中的所有参数,因此您可能不想这样做
我会使用set
方法,因此您可以:
$request->request->set('tactill_customerbundle_customertype', $newValue)
您可以在Symfony2文档()中阅读更多内容-您正在查找Symfony\Component\HttpFoundation\Request
(这是$Request
变量),然后在调用Request()
方法时返回Symfony\Component\HttpFoundation\ParameterBag
。:$all=$request->request->all()$所有['Tacell\u customerbundle\u customertype']=$newValue$请求->请求->替换($all)代码>这允许修改数组参数。