使用PHP清除浏览器历史记录 [英] Clear the Browser History using PHP

查看:544
本文介绍了使用PHP清除浏览器历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的mysql数据库中,我具有配置文件图片的文件名.

喜欢
ID文件名
1 1.jpg
2 2.jpg
3 3.jpg

并在一个文件夹中存储图片.
通过代码,我更改了文件夹中的图片,并使用了相同的名称.所以我的桌子没有变化.

但是浏览器只显示前一张图片,直到我清除浏览器历史记录为止.

可以从我的问题中恢复过来的事情提供帮助.
通过代码或任何其他建议清除历史记录.

请帮忙.

In my mysql database I have the file name of the profile pictures.

like
ID File_Name
1 1.jpg
2 2.jpg
3 3.jpg

and in a folder I am storing the pictures.
Through code I have change the picture in the folder and with the same name as it was. So no change in my table.

But browser display the previous picture only until I have clear the Browser History.

Help by something which can recover me from my problem.
Either by clearing history through code or any other suggestion.

Please help.

推荐答案

通过在图像URL上添加一个伪随机参数,就像这样,很容易做到:
That''s easy to do by adding a dummy random parameter to the image URL like this:
<img src="./images/1.jpg?dummy=1244356234"/>



除了使用随机数,您还可以使用一个递增计数器,该计数器在每次更改图像时都会递增.

另一种方法是设置标头,以禁止浏览器缓存图像.

此致

—曼弗雷德(Manfred)



Instead of using a random number you could just use an increasing counter that gets incremented every time you change the images.

Another approach would be to set a header that will prohibit the image being cached by the browser.

Regards,

— Manfred


这篇关于使用PHP清除浏览器历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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