PHP强制刷新图像 [英] PHP force refresh image

查看:76
本文介绍了PHP强制刷新图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个输入表单,允许用户上传图像.提交完毕后,用户将返回到表单的顶部,并在其顶部显示构图位.

I'm creating an input form that allows users to upload an image. Once it has been submitted the user is returned to the form with a conformation bit at the top.

然后,通过查询将已提交的任何图像预览到存储该图像URL的MySQL数据库中.但是,如果用户上传了照片,将对其进行预览,然后他们决定更改该照片并重新提交表单,当您将其带回到表单时,除非您在浏览器上手动按刷新",否则不会显示新照片.

Any image that has been submitted is then previewed via a query to a MySQL database that stores the URL of the image. However, if the user uploads a photo, it is previewed, and then they decide to change that photo and resubmit the form, when it takes you back to the form the new photo doesn't show unless you manually press refresh on the browser.

是否有任何方法可以强制刷新/缓存删除或针对该特定图像而不是整个页面进行刷新?

Is there any way of forcing a refresh/cache deletion or refresh for that specific image rather than the whole page?

谢谢

推荐答案

将修改后的日期作为查询添加到图像的末尾.

Add the modified date to the end of the image as a query.

<img src="/images/photo.png?=1239293"/>

在PHP中

<img src="/images/photo.png?=<?php echo filemtime($filename)?>"/>

这篇关于PHP强制刷新图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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