我试图将2 Controller结果放在一个 Controller 中,所以我使用'$response = $this->forward('Bundle:Controller:functionXXX');'在第一个中转发。

在 Controller 'functionXXXAction'中,我使用renderView返回响应。

问题在于转发函数在页面顶部返回此 header :

"HTTP/1.0 200 OK Cache-Control: no-cache Date: Wed, 24 Apr 2013 09:56:50 GMT"

有什么办法可以将其从页面中隐藏吗?

最佳答案

这个问题有点老了,但也许将来有人会寻找答案。要摆脱标题,您只需要调用:
$ response = $ this-> forward('Bundle:Controller:functionXXX');
$ response-> getContent();

关于Symfony2 |从响应/转发中隐藏/删除标题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16189134/

10-12 00:32
查看更多