dongque3797 2014-10-07 16:38
浏览 182
已采纳

如何清除缓存或使图像在html中再次运行代码?

I was running this code

<img src="../graphics/g_builder.php?type=funil&interval=1"/>
<img src="../graphics/g_builder.php?type=funil&interval=3"/>
<img src="../graphics/g_builder.php?type=conversao&interval=2"/>
<img src="../graphics/g_builder.php?type=conversao&interval=3"/>
<img src="../graphics/g_builder.php?type=nps&interval=2"/>

That generates an image in a folder that the rest of the code use later, but it only works one time or pressing ctrl +f5 which clears cache if im not wrong...

So i need a way to renew this images everytime i call the php or somehow clear the cache but without using headers... what can i do?

  • 写回答

1条回答 默认 最新

  • doushi5117 2014-10-07 16:41
    关注

    You could append the timestamp as a property to the end of the src attribute. For example:

    <img src="../graphics/g_builder.php?type=nps&amp;interval=2&amp;time=<?php print time(); ?>"/>
    

    This way, every time you refresh the page, the src attribute will be different.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序