gpt4 book ai didi

php - 显示缓存 header

转载 作者:行者123 更新时间:2023-12-04 14:07:42 24 4
gpt4 key购买 nike

Symfony 2 正在显示缓存 header ,我想知道如何隐藏它们

例子

HTTP/1.0 200 OK Cache-Control: no-cache Content-Type: text/html Date: Fri, 18 Jan 2013 19:07:08 GMT HTTP/1.0 200 OK Cache-Control: no-cache Date: Fri, 18 Jan 2013 19:07:08 GMT X-Debug-Token: 50f99d5cba4da

我在我的代码中使用它

return new Response($this->renderView('Shout/view/default.html.twig'));

它被调用

$httpKernel = $this->container->get('http_kernel');
$response = new Response;
$response->SetContent($httpKernel->forward('MyBundle:Module/'.$module.'/'.$module.':index'));
$response->headers->set('Content-Type', 'text/html');
return $response;

在 Twig 扩展中

最佳答案

添加 ->getContent() 结束。

http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Response.html

    $response = $this->forward("MyBundle:Module:$module", array(
'customer_id' => $customer_id
))->getContent();

return $response;

关于php - 显示缓存 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14405916/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com