Clear and delete the folder after the time specified in php
<?
$days = 1;
$dir = dirname ( __FILE__ );
$nofiles = 0;
if ($handle = opendir($dir)) {
while (( $file = readdir($handle)) !== false ) {
if ( $file == '.' || $file == '..' || is_dir($dir.'/'.$file) ) {
continue;
}
if ((time() - filemtime($dir.'/'.$file)) > ($days *86400)) {
$nofiles++;
unlink($dir.'/'.$file);
}
}
closedir($handle);
echo "Total files deleted: $nofiles \n";
}
?>
Also in PHP:
- array_key_first not works
- contains functin php
- codeigniter get last inserted data row
- Pacific Daylight Time Zone php
- Created Migration: laravel
- codeigniter
- corsair k70 rgb mk.2
- date() function php
- The main error reporting flags include
- add pagination to wordpress
- convert to int php
- check substring in string php
- convert array to object php
- convert a image to base64 data in php and show image
- drop down php form retrieve data from database
- Your Composer dependencies require a PHP version ">= 7.2.5". You are running 7.2.0. in
- Error: Cannot redeclare composerRequire1d8e02dff94f518b7a14ddcb6710f10d() (previously declared in /Applications/XAMPP/xamppfiles/htdocs/all4learn2/Vendor/composer/autoload_real.php:66)
- exception handling php databse
- alert js in php
- check if table exists sql php
- codeigniter db last insert id
- check urel in php
- base64 to image
- can we use a header function to redirect the user to another page