Thiago Sabin
Thiago Sabin

Reputation: 137

How to clear cache or make the images run the code again in 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?

Upvotes: 0

Views: 62

Answers (1)

Alex
Alex

Reputation: 5278

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.

Upvotes: 3

Related Questions