简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM