-
-
Save locvfx/876873240a047ae03a864d51c3460097 to your computer and use it in GitHub Desktop.
PHP Clean up cache folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CleanUp_Cache_Folder(){ | |
## Automatic cleanup Cache folder | |
$cache_folder = 'cache/'; | |
$file_type = '*.mp3'; | |
$files = glob($cache_folder.$file_type); | |
$time = time(); | |
foreach ($files as $file) | |
if (is_file($file)) | |
if ($time - filemtime($file) >= 60*60*24*1) // 1 days | |
unlink($file); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment