如何更改filemtime文件目录删除



我有以下代码。

$days = 7;   
// Check if the file is older than X days old  
if (filemtime($path.$file) < ( time() - ( $days * 24 * 60 * 60 ) ) )  
{  
    // Do the deletion  
    unlink($path.$file);  
}

我想将$days更改为$minute,如何进行更改?

如果要检查文件是否早于x分钟,则可能会应用以下代码。

$minutes = 15;
// Check if the file is older than x minutes
if (filemtime($path.$file) < ( time() - ( $minutes * 60 ) ) ) {  
    // Do the deletion  
    unlink($path.$file);  
}
$minute = 1440 * $days;
// there are 1440 minutes in a day

我不知道你是不是这么问的。。但这似乎是恰当的。

最新更新