Home\Controller\UpdateController::_clear_runtime PHP Method

_clear_runtime() private method

private _clear_runtime ( $path = RUNTIME_PATH )
    private function _clear_runtime($path = RUNTIME_PATH)
    {
        //给定的目录不是一个文件夹
        if (!is_dir($path)) {
            return null;
        }
        $fh = opendir($path);
        while (($row = readdir($fh)) !== false) {
            //过滤掉虚拟目录
            if ($row == '.' || $row == '..' || $row == 'index.html') {
                continue;
            }
            if (!is_dir($path . '/' . $row)) {
                unlink($path . '/' . $row);
            }
            $this->_clear_runtime($path . '/' . $row);
        }
        //关闭目录句柄,否则出Permission denied
        closedir($fh);
        return true;
    }