如果時間戳超過20分鐘,我試圖刪除$ lockfile。 if (file_exists($lockfile) && time() - filemtime($lockfile) > strtotime("+20 minutes")) {
// If lockfile is alive for more than 20 minutes, unlink it
unlink($loc
我想從特定類別中刪除超過特定年齡(例如2個月)的圖像。 這些圖像位於某個目錄裏,如果我用下面的代碼: <?php
// define the directory
$dir = "images/";
// cycle through all files in the directory
foreach (glob($dir."*") as $file) {
// if fil