示例#1
0
 function delete_directory($dir)
 {
     if (!file_exists($dir)) {
         return true;
     }
     if (!is_dir($dir) || is_link($dir)) {
         return unlink($dir);
     }
     foreach (scandir($dir) as $item) {
         if ($item == '.' || $item == '..') {
             continue;
         }
         $itemname = $dir . "/" . $item;
         if (!SystemUtil::delete_directory($itemname)) {
             chmod($itemname, 0777);
             if (!SystemUtil::delete_directory($itemname)) {
                 return false;
             }
         }
     }
     return rmdir($dir);
 }
示例#2
0
文件: Tempdir.php 项目: jlsa/justitia
 function __destruct()
 {
     if ($this->delete) {
         SystemUtil::delete_directory($this->dir);
     }
 }