我有一个在 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/