I am building my blog by PHP and Godaddy apache server, recently I face a problem that I cannot clear the explorer cache so that each time when I change my style.css I have to change the name of the css file. So can you tell what is wrong or how can I clear the css cache?
You can make the browser automatically clear cache if you create a version
based on file modified time
eg:
$filename = '/css/style.css';
$fileModified = substr(md5(filemtime($filename)), 0, 6);
// $fileModified = filemtime($filename); // - with version as timestamp.
and HTML
<link rel="stylesheet" type="text/css" href="<?php echo $filename;?>?v=<?php echo $fileModified ; ?>">
Put Version Number for your css file like following,
style.css?v=1 or style.css?v=1.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With