Hobby

Backup system to build!

Last week, my home system was broken! This system is virtual machine by VMware(ESXi5.0). Sevral virtual OS was not to start. I was recovering the system. But part of data was lost. I thought it need strong backup system to my home system. So, I will b...

Conditions by timestamp by PHP

PHP:
  1. // Specifies the file path where PHP wants to check the timestamp
  2. $file_path = '/var/www/html/';
  3.  
  4. if($dir = opendir($file_path)){
  5.     while(($file = readdir($dir)) !== false){
  6.         if($file != '.' && $file != '..'){
  7.             // Get timestamp
  8.             $get_unix = filemtime($file);
  9.                
  10.             // Specify the time range(condition)
  11.             if(strtotime('2013-02-01 22:30:00') <= $get_unix && $get_unix <= strtotime('2013-02-01 22:40:00')){
  12.                 echo $file.' is 「2013/02/01 22:30:00」 ~ 「2013/02/01 22:40:00」['.date('Y/m/d H:i:s',$get_unix).']<br />';
  13.             }else{
  14.                 echo $file.'is not「2013/02/01 22:30:00」 ~ 「2013/02/01 22:40:00」['.date('Y/m/d H:i:s',$get_unix).']<br />';
  15.             }
  16.         }
  17.     }
  18. }

タイトルとURLをコピーしました