gpt4 book ai didi

php - 让 zend 每次访问都清除缓存?

转载 作者:搜寻专家 更新时间:2023-10-31 21:15:48 24 4
gpt4 key购买 nike

我有一个在 zend 框架中开发的应用程序。我需要确保浏览器是每次加载我的网站时都不使用缓存。有没有办法让zend每次访问都清空缓存?我正在寻找可能的 ini 设置。

最佳答案

如果您使用 session (Zend_Session),PHP 会自动发送这些 header 。

如果你不使用 session ,在 Zend Controller 中,你可以使用这个:

<?php

class SomeController extends Zend_Controller_Action {
function indexAction(){
$this->getResponse()->setHeader('Cache-Control','no-store, no-cache, must-revalidate, post-check=0, pre-check=0',1);
$this->getResponse()->setHeader('Expires','Thu, 19 Nov 1981 08:52:00 GMT',1);
$this->getResponse()->setHeader('Pragma','no-cache',1);
}
}

关于php - 让 zend 每次访问都清除缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9091581/

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