Exemplo n.º 1
0
/**
 * 循环删除指定目录下的文件及文件夹
 * @param string $dirpath 文件夹路径
 */
function RTCDelDir($dirpath)
{
    $dh = opendir($dirpath);
    while (($file = readdir($dh)) !== false) {
        if ($file != "." && $file != "..") {
            $fullpath = $dirpath . "/" . $file;
            if (!is_dir($fullpath)) {
                unlink($fullpath);
            } else {
                RTCDelDir($fullpath);
                rmdir($fullpath);
            }
        }
    }
    closedir($dh);
    $isEmpty = 1;
    $dh = opendir($dirpath);
    while (($file = readdir($dh)) !== false) {
        if ($file != "." && $file != "..") {
            $isEmpty = 0;
            break;
        }
    }
    return $isEmpty;
}
Exemplo n.º 2
0
 /**
  * 是否新窗口打开
  */
 public function editiIsOpen()
 {
     $rd = array('status' => -1);
     if (I('id', 0) == 0) {
         return $rd;
     }
     $m = M('navs');
     $m->isOpen = I('isOpen') == 1 ? 1 : 0;
     $rs = $m->where("id = " . (int) I('id', 0))->save();
     if (false !== $rs) {
         $rd['status'] = 1;
         RTCDelDir(C('RTC_RUNTIME_PATH') . "/Data/navigation");
     }
     return $rd;
 }
Exemplo n.º 3
0
 /**
  * 清除缓存
  */
 public function cleanAllCache()
 {
     $this->isAjaxLogin();
     $rv = array('status' => -1);
     $rv['status'] = RTCDelDir(C('RTC_RUNTIME_PATH'));
     $this->ajaxReturn($rv);
 }