I’m having a problem. I’ve got a file that I only want to update on a daily basis. So I’m using filemtime and an expiry timestamp and checking them against each other…problem is I’m getting the echo statement every time I’m refreshing the page. Any ideas?
$time_expire = time() + 24*60*60; // Expire Time (1 Day)
// Check file change time
if(filemtime($cache_filename) <= $time_expire) {
echo 'file is too old - refresh it';
}
Just think through the logic slowly:
Yes, I think that will always be
true. Unless your file is From The Future™.Your expiry timestamp has to be a day in the past.