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.

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

报告相同问题?