目前,我每天缓存文件,但我如何缓存这个文件每周一次,例如星期天?我不知道如何继续。缓存一个文件,如果它是某一天
if(time() - filemtime($cache) > 86400){
$result = file_get_contents($url);
file_put_contents($cache, serialize($result));
$flux = json_decode($result);
}else{
$result = unserialize(file_get_contents($cache));
$flux = json_decode($result);
}
cron作业可能? –