Пример #1
0
 /**
  * 清空所有SESSION
  *
  * @return boolean
  */
 public function cleanup()
 {
     switch ($this->_type) {
         case 'mem':
             return $this->_mem->flush();
         case 'db':
         case 'mdb':
             return $this->_db->truncate($this->_opt);
         case 'file':
             return self::kill_sfile($this->_path, true);
         case 'dir':
             $dir = 'abcdefghijklmnopqrstuvwxyz';
             $len = strlen($dir);
             for ($i = 0; $i < $len; ++$i) {
                 wcore_fso::rm_dir($dir[$i]);
             }
         default:
             return true;
     }
 }
Пример #2
0
 /**
  * 递归删除文件夹
  *
  * @param    string $path 要删除的文件夹路径
  * @return    boolean    删除成功为true失败为false
  */
 public static function rm_dir($path)
 {
     if (empty($path)) {
         return false;
     }
     if ($objs = glob("{$path}/*")) {
         foreach ($objs as $obj) {
             is_dir($obj) ? wcore_fso::rm_dir($obj) : unlink($obj);
         }
     }
     return rmdir($path);
 }