如何将所有请求查询参数传递给 twig symfony 2 中的嵌入式控制器? [英] how to pass all request query parameters to embedded controllers in twig symfony 2?

查看:25
本文介绍了如何将所有请求查询参数传递给 twig symfony 2 中的嵌入式控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{{ render(controller("SomeBundle:Foo:Bar", {HERE I WANT TO PASS ALL query parameters app.request.query.all}) }}

那么我是否可以访问子请求中的所有主请求查询参数,并且子请求也应该独立运行?

So can I access all master request query parameters in sub request and the subrequest should also run independently?

推荐答案

试试这个:

{{ render(controller("SomeBundle:Foo:bar", {'all': app.request.query.all}) }}

并将其存储在 $all 变量中

and in action store it in $all variable

public function barAction($all) {
    // other your code
}

这篇关于如何将所有请求查询参数传递给 twig symfony 2 中的嵌入式控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆