我有以下代碼。如何更改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
,我該如何去改變它?
我有以下代碼。如何更改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);
}
不記得變量文件時間* 24 * 60 * 60)))確定刪除H.m * 60)))謝謝! –
$minute = 1440 * $days;
// there are 1440 minutes in a day
我不知道這是你在問什麼,但它似乎是適當的。
no $ days = 7;更改變量分鐘? $ minute = 1; //檢查文件是否比X天早 if(filemtime($ path。$ file)<(time() - ($ minute * 60 * 60))) {??? \ –
你可以嗎請證明你的回答並提出問題作爲評論? =) – bonCodigo
是否要檢查文件是否早於'x'分鐘? –
這會太簡單回答嗎?只是一個數學問題。 – Raptor
是不要刪除在一天刪除文件分鐘新變量$分鐘= 1; –