Answer the question
In order to leave comments, you need to log in
What is the best way to reset the cache of site users?
Suppose all users have a cached site (js / css / img)
You have cooked a delicious borscht, to eat which you need to clear the cache.
I do like this:
$cache_url = '?08062021';
echo '<img src="img.png'.$cache_url.'">';
Answer the question
In order to leave comments, you need to log in
Alternatively, you can use the filemtime function
echo '<img src="img.png?'.filemtime('img.png').'">';
$cache_url = '?' . time();
echo '<img src="img.png' . $cache_url.'">';
<?php
ob_clean();
ob_start();
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question