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

如何清除缓存或使图像在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?

我正在运行此代码 p>

 &lt; img src =  “../graphics/g_builder.php?type=funil&interval=1"/>
<img src =”../ graphics / g_builder.php?type = funil&amp; interval = 3“/&gt; 
&lt  ; img src =“../ graphics / g_builder.php?type = conversao&amp; interval = 2”/&gt; 
&lt; img src =“../ graphics / g_builder.php?type = conversao&amp; interval = 3”/  &gt; 
&lt; img src =“../ graphics / g_builder.php?type = nps&amp; interval = 2”/&gt; 
  code>  pre> 
 
 

生成图像 在其余代码稍后使用的文件夹中,但它只能工作一次或按ctrl + f5清除缓存,如果我没有错... p>

所以我需要一种方法 每次我调用php或以某种方式清除缓存但不使用标题时更新此图像...我该怎么办? p> div>

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.