如何停用浏览器中的缓存? [英] How do I deactivate caching in browsers?

查看:105
本文介绍了如何停用浏览器中的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如果退出Yahoo邮件,然后单击后退按钮,它将不会加载最后一页,而是会将您重定向到登录页面。

For instance, if you exit your Yahoo mail and then click the back button, it will not load the last page, it will redirect you to the login page.

必须使用我的PHP代码来执行此操作,我正在使用CodeIgniter。

I have to do this with my PHP code, I'm using CodeIgniter.

一些朋友告诉我禁用缓存,但这将是一件坏事,因为我有一个

Some friends told me to disable caching but that will be a bad thing because I have a lot of images in my system and it would be bad to download them every time.

如何使用PHP做到这一点?

How do I do this with PHP?

推荐答案

使用以下代码禁用页面的缓存:

Disable caching of your page with the following code :

http://php.net/manual/en/function.header.php

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

这篇关于如何停用浏览器中的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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