当前位置: 首页>>代码示例>>PHP>>正文


PHP dir_clear函数代码示例

本文整理汇总了PHP中dir_clear函数的典型用法代码示例。如果您正苦于以下问题:PHP dir_clear函数的具体用法?PHP dir_clear怎么用?PHP dir_clear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dir_clear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dir_clear

function dir_clear($dir_name)
{
    if (is_dir($dir_name) == false) {
        return false;
    }
    $dir_handle = opendir($dir_name);
    while (($file = readdir($dir_handle)) !== false) {
        if ($file != '.' and $file != "..") {
            if (is_dir($dir_name . '/' . $file)) {
                dir_clear($dir_name . '/' . $file);
            }
            if (is_file($dir_name . '/' . $file)) {
                @unlink($dir_name . '/' . $file);
            }
        }
    }
    closedir($dir_handle);
    return true;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:19,代码来源:global.func.php

示例2: cleardir

function cleardir($dir)
{
    global $lang;
    showjsmessage(lang('clear_dir') . ' ' . str_replace(ROOTDIR, '', $dir));
    dir_clear($dir);
}
开发者ID:jorkin,项目名称:meiupic,代码行数:6,代码来源:install_func.php

示例3: showfooter

?action=db">please click here to start upgrade</a></p>

<?php 
    showfooter();
} elseif ($action == 'db') {
    showheader();
    echo "<h4>Table structure update</h4>";
    @touch(UC_ROOT . './data/install.lock');
    //vot	@unlink(UC_ROOT.'./install/index.php');
    $db = new ucserver_db();
    $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
    runquery($sql);
    dir_clear(UC_ROOT . './data/view');
    dir_clear(UC_ROOT . './data/cache');
    if (is_dir(UC_ROOT . './plugin/setting')) {
        dir_clear(UC_ROOT . './plugin/setting');
        @unlink(UC_ROOT . './plugin/setting/index.htm');
        @rmdir(UC_ROOT . './plugin/setting');
    }
    echo "Processing the short message data";
    $url_forward = "upgrade_1.5.2_1.6.0.php?action=pm&forward=" . urlencode($forward);
    echo "<br /><br /><br /><a href=\"{$url_forward}\">Browser will automatically reload the page, without human intervention. If your browser does not redirect for a long time, please click here</a>";
    echo "<script>setTimeout(\"redirect('{$url_forward}');\", 1250);</script>";
    showfooter();
} elseif ($action == 'pm') {
    showheader();
    echo "<h4>Processing the short message data</h4>";
    $db = new ucserver_db();
    $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
    $total = getgpc('total');
    $start = getgpc('start') ? getgpc('start') : 0;
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:upgrade_1.5.2_1.6.0.php

示例4: intval

 $num = $num ? intval($num) : 1;
 $random = getgpc('random');
 if (empty($random)) {
     $dir = UC_ROOT . './data/upgsecques';
     $directory = dir($dir);
     while ($entry = $directory->read()) {
         if (preg_match('/^secques_(\\w+)_\\d+/', $entry, $match)) {
             break;
         }
     }
     $random = $match[1];
 }
 $dump_file = UC_ROOT . './data/upgsecques/secques_' . $random . '_' . $num . '.sql';
 if (!file_exists($dump_file)) {
     @touch($lock_file);
     dir_clear(UC_ROOT . './data/upgsecques');
     setcookie('uc_authcode', '');
     showheader();
     echo '安全提问升级完成,感谢您使用本程序';
 } else {
     showheader();
     $sql = file_get_contents($dump_file);
     $db = new db();
     $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET);
     runquery($sql);
     $num++;
     echo "安全提问正在导入";
     $url_forward = "upgrade2.php?action=upgsecques&num={$num}&random={$random}";
     echo "<br /><br /><br /><a href=\"{$url_forward}\">浏览器会自动跳转页面,无需人工干预。除非当您的浏览器长时间没有自动跳转时,请点击这里</a>";
     echo "<script>setTimeout(\"redirect('{$url_forward}');\", 1250);</script>";
 }
开发者ID:pan289091315,项目名称:Discuz,代码行数:31,代码来源:upgrade2.php

示例5: clear_cache

 function clear_cache()
 {
     need_login('ajax_page');
     dir_clear(ROOTDIR . 'cache/data');
     dir_clear(ROOTDIR . 'cache/templates');
     dir_clear(ROOTDIR . 'cache/tmp');
     //清除缩略图片缓存
     $files = glob(ROOTDIR . 'cache/dimgs/[a-zA-Z0-9][a-zA-Z0-9]/*.php');
     //用glob通过通配符搜索所有缓存文件
     if ($files) {
         foreach ($files as $file) {
             @unlink($file);
         }
     }
     ajax_box(lang('clear_cache_success'), null, 0.5, $_SERVER['HTTP_REFERER']);
 }
开发者ID:vluo,项目名称:myPoto,代码行数:16,代码来源:setting.ctl.php

示例6: pick_download

function pick_download()
{
    $client_info = get_client_info();
    $version_md5total = $_GET['md5_total'];
    $new_version_md5total = $_GET['new_md5_total'];
    $key = $_GET['key'];
    $version = $_GET['version'];
    $version_dateline = $_GET['version_dateline'];
    $i = intval($_GET['i']);
    if (!$client_info) {
        cpmsg_error(milu_lang('lan_upgrage'));
    }
    $p = intval($_GET['p']);
    $count = $_GET['count'];
    $file_md5 = $_GET['file_md5'];
    $tmpdir = DISCUZ_ROOT . './data/download/dxc_temp';
    pload('C:cache');
    $md5s = array();
    $str = $_SERVER['QUERY_STRING'];
    if ($p == 0) {
        dir_clear($tmpdir);
        dmkdir($tmpdir, 0777, false);
        cpmsg(milu_lang('diff_upgrade_file'), PICK_GO . 'pick_info&ac=pick_download&key=' . $key . '&p=1', 'loading', '', false);
    } else {
        if ($p == 1) {
            $url = GET_URL . 'plugin.php?id=pick_user:upgrade&myac=download_file&php_version=' . phpversion() . '&tpl=no&domain=' . urlencode($client_info['domain']) . '&key=' . $key . '&file_md5=' . $file_md5;
            $data = get_contents($url, array('cache' => -1));
            if (!$data || $data == '-1') {
                cpmsg_error(milu_lang('no_normal_get'));
            }
            $msg_arr = (array) json_decode(base64_decode($data));
            if (!$_GET['file_md5']) {
                $download_file_data = upgrade_file_diff($msg_arr['md5']);
                $md5_temp_arr = array_keys($download_file_data);
                $version_md5total = md5(implode('', $md5_temp_arr));
                $count = count($download_file_data);
                $version = $version ? $version : $msg_arr['Version'];
                $version_dateline = $version_dateline ? $version_dateline : $msg_arr['version_dateline'];
            } else {
                $download_file_data = load_cache('download_file_data');
                $filename = $tmpdir . '/' . $msg_arr['file'] . '._addons_';
                $dirname = dirname($filename);
                dmkdir($dirname, 0777, false);
                $fp = fopen($filename, 'w');
                if (!$fp) {
                    cpmsg('cloudaddons_download_write_error', '', 'error');
                }
                fwrite($fp, gzuncompress(base64_decode($msg_arr['text'])));
                fclose($fp);
                if ($msg_arr['MD5']) {
                    $new_version_md5total .= $msg_arr['MD5'];
                    if ($msg_arr['MD5'] != md5_file($filename)) {
                        dir_clear($tmpdir);
                        cpmsg(milu_lang('cloudaddons_download_error'), '', 'error');
                        //数据下载错误
                    }
                }
            }
            $file_md5_arr = array_keys($download_file_data);
            $file_md5 = $file_md5_arr[$i];
            $file = $download_file_data[$file_md5];
            $p = $i == $count ? 2 : 1;
            $percent = $i / $count;
            $percent = sprintf("%01.0f", $percent * 100) . '%';
            cache_data('download_file_data', $download_file_data);
            cpmsg(milu_lang('pick_upgrade_downloading_file', array('file' => $file, 'percent' => $percent)), PICK_GO . 'pick_info&ac=pick_download&i=' . ($i + 1) . '&md5_total=' . $version_md5total . '&new_md5_total=' . $new_version_md5total . '&key=' . $key . '&p=' . $p . '&version=' . $version . '&version_dateline=' . $version_dateline . '&count=' . $count . '&file_md5=' . $file_md5, 'loading', '', false);
        } else {
            if ($p == 2) {
                if ($new_version_md5total !== '' && md5($new_version_md5total) !== $version_md5total) {
                    dir_clear($tmpdir);
                    cpmsg(milu_lang('cloudaddons_download_error'), '', 'error');
                    //数据下载错误
                }
                cpmsg(milu_lang('DXC_installing'), PICK_GO . 'pick_info&ac=pick_install&version=' . $version . '&version_dateline=' . $version_dateline, 'loading', '', false);
            }
        }
    }
}
开发者ID:edmundwong,项目名称:V604,代码行数:78,代码来源:function.copyright.php

示例7: libfile

    require_once libfile('function/admincp');
    require_once libfile('function/importdata');
    $dir = DB::result_first("SELECT t.directory FROM " . DB::table('common_style') . " s LEFT JOIN " . DB::table('common_template') . " t ON t.templateid=s.templateid WHERE s.styleid='1'");
    import_styles(1, $dir, 1, 0);
    DB::update('common_setting', array('svalue' => 1), "skey='styleid'");
    show_msg(lang('update', 'default_style_restored'), "{$theurl}?step=cache");
} elseif ($_GET['step'] == 'cache') {
    if (!$devmode && @($fp = fopen($lockfile, 'w'))) {
        fwrite($fp, ' ');
        fclose($fp);
    }
    dir_clear(ROOT_PATH . './data/template');
    dir_clear(ROOT_PATH . './data/cache');
    dir_clear(ROOT_PATH . './data/threadcache');
    dir_clear(ROOT_PATH . './uc_client/data');
    dir_clear(ROOT_PATH . './uc_client/data/cache');
    show_msg(lang('update', 'database_updated') . '<iframe src="../misc.php?mod=initsys" style="display:none;"></iframe>');
}
function has_another_special_table($tablename, $key)
{
    if (!$key) {
        return $tablename;
    }
    $tables_array = get_special_tables_array($tablename);
    if ($key > count($tables_array)) {
        return FALSE;
    } else {
        return TRUE;
    }
}
function get_special_tables_array($tablename)
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:update.php

示例8: config_edit

        config_edit();
        require TIPASK_ROOT . './lib/db.class.php';
        $db = new db($dbhost, $dbuser, $dbpw, $dbname, DBCHARSET);
        $sql = file_get_contents($sqlfile);
        $sql = str_replace("\r\n", "\n", $sql);
        if (!VIEW_OFF) {
            show_header();
            show_install();
        }
        runquery($sql);
        //add default user
        $db->query("INSERT INTO `" . $tablepre . "user` SET `username`='" . $admininfo['ucadminname'] . "', `password`='" . md5(trim($admininfo['ucfounderpw'])) . "',`email`='" . $admininfo['ucadminemail'] . "',`groupid`=1,`credits`=200,`credit1`=100,`credit2`=100,`regip`='" . $_SERVER["REMOTE_ADDR"] . "'");
        $db->query("INSERT INTO `" . $tablepre . "setting` SET `k`='auth_key',`v`='" . generate_key() . "'");
        $db->query("INSERT INTO `" . $tablepre . "setting` SET `k`='admin_email',`v`='" . $admininfo['ucadminemail'] . "'");
        $db->query("INSERT INTO `" . $tablepre . "setting` SET `k`='admin_email',`v`='" . $admininfo['ucadminemail'] . "'");
        dir_clear(TIPASK_ROOT . './data/cache');
        //clear up the old data cathe
        VIEW_OFF && show_msg('initdbresult_succ');
        if (!VIEW_OFF) {
            echo '<script type="text/javascript">document.getElementById("step3").disabled=false;document.getElementById("step3").value = \'' . lang('install_succeed') . '\';</script>' . "\r\n";
            show_footer();
        }
    }
    if (VIEW_OFF) {
        show_msg('missing_parameter', '', 0);
    } else {
        show_form($form_db_init_items, $error_msg);
    }
} elseif ($method == 'post_siteinfo') {
    $infoarr = array('site_url' => $site_url, 'domain' => $_SERVER['HTTP_HOST'], 'version' => TIPASK_VERSION);
    $info = urlencode(base64_encode(serialize($infoarr)));
开发者ID:source-hunter,项目名称:tipask,代码行数:31,代码来源:index.php

示例9: bra_users

    echo "          <td><b><font color=\"#FF0000\">&gt;</font><font color=\"#000000\"> {$lang['create_table']}</font></b></td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    $extrasql = <<<EOT
INSERT INTO bra_users (username,`password`,groupid) VALUES ('{$username}','{$brpswd}','9');
EOT;
    runquery($sql);
    runquery($extrasql);
    loginit('adminlog');
    loginit('newsinfo');
    dir_clear('./gamedata/bak');
    //dir_clear('./gamedata/log');
    //dir_clear('./gamedata/mapitem');
    //dir_clear('./gamedata/shopitem');
    dir_clear('./gamedata/templates');
    echo $lang['init_game'];
    $adminmsg = setconfig($_POST['adminmsg']);
    $startmode = (int) $_POST['startmode'];
    $iplimit = (int) $_POST['iplimit'];
    if ($startmode == 1) {
        $starthour = 10;
    } elseif ($startmode == 2) {
        $starthour = 1;
    } else {
        $starthour = 0;
    }
    $fp = fopen('./gamedata/system.php', 'r');
    $systemfile = fread($fp, filesize('./gamedata/system.php'));
    fclose($fp);
    $systemfile = preg_replace("/[\$]adminmsg\\s*\\=\\s*[\"'].*?[\"'];/is", "\$adminmsg = '{$adminmsg}';", $systemfile);
开发者ID:winddramon,项目名称:dts,代码行数:31,代码来源:install.php

示例10: header

<?php

header('content-type:text/html;charset=utf-8');
//unlink()只能删除文件而不能删除目录
//$filename='abc/readme.txt';
//unlink($filename);
//删除指定目录下的所有文件
$dir = 'abc/b';
//删除b文件夹下的所有文件,不能删除文件夹
function dir_clear($dir)
{
    $directory = dir($dir);
    //创建一个dir类(Php手册上这么说的),用来读取目录中的每一个文件
    while ($entry = $directory->read()) {
        //循环每一个文件,并取得文件名$entry
        $filename = $dir . '/' . $entry;
        //取得完整的文件名,带路径的
        if (is_file($filename)) {
            //如果是文件,则执行删除操作
            @unlink($filename);
        }
    }
    $directory->close();
    //关闭读取目录文件的类
}
dir_clear($dir);
开发者ID:denson7,项目名称:phpstudy,代码行数:26,代码来源:unlink.php

示例11: loginit

    echo "          <td>\n";
    echo "            <hr noshade align=\"center\" width=\"100%\" size=\"1\">\n";
    echo "          </td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td><b><font color=\"#FF0000\">&gt;</font><font color=\"#000000\"> {$lang['init_file']}</font></b></td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    loginit('adminlog');
    loginit('errorlog');
    if (@($fp = fopen($lockfile, 'w'))) {
        fwrite($fp, 'Cyask 3.2');
        fclose($fp);
    }
    dir_clear(CYASK_ROOT . './askdata/templates');
    ?>
          </td>
        </tr>
        <tr>
          <td>
            <hr noshade align="center" width="100%" size="1">
          </td>
        </tr>
        <tr>
          <td align="center">
            <font color="#FF0000"><b><?php 
    echo $lang['install_succeed'];
    ?>
</font><br>
            <?php 
开发者ID:tanny2015,项目名称:DataStructure,代码行数:31,代码来源:index.php

示例12: VALUES

    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('authkey', '{$authkey}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('siteuniqueid', '{$siteuniqueid}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('backupdir', '" . $backupdir . "')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('extcredits', '" . addslashes(serialize($extcredits)) . "')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('attachdir', '{$attachdir}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('attachurl', '{$attachurl}')");
    $db->query("REPLACE INTO {$tablepre}settings (variable, value) VALUES ('videoinfo', '" . addslashes(serialize($videoinfo)) . "')");
    $db->query("DELETE FROM {$tablepre}members");
    $db->query("DELETE FROM {$tablepre}memberfields");
    $db->query("INSERT INTO {$tablepre}members (uid, username, password, secques, adminid, groupid, regip, regdate, lastvisit, lastpost, email, dateformat, timeformat, showemail, newsletter, timeoffset) VALUES ('1', '{$username}', '{$password}', '', '1', '1', 'hidden', '" . time() . "', '" . time() . "', '" . time() . "', '{$email}', '', '0', '1', '1', '9999');");
    $db->query("INSERT INTO {$tablepre}memberfields (uid, bio, sightml, ignorepm, groupterms) VALUES ('1', '', '', '', '')");
    $db->query("UPDATE {$tablepre}crons SET lastrun='0', nextrun='" . ($timestamp + 3600) . "'");
    foreach ($optionlist as $optionid => $option) {
        $db->query("INSERT INTO {$tablepre}typeoptions VALUES ('{$optionid}', '{$option['classid']}', '{$option['displayorder']}', '{$option['title']}', '', '{$option['identifier']}', '{$option['type']}', '" . addslashes(serialize($option['rules'])) . "');");
    }
    $db->query("ALTER TABLE {$tablepre}typeoptions AUTO_INCREMENT=3001");
    $yearmonth = date('Ym_', time());
    loginit($yearmonth . 'ratelog');
    loginit($yearmonth . 'illegallog');
    loginit($yearmonth . 'modslog');
    loginit($yearmonth . 'cplog');
    loginit($yearmonth . 'errorlog');
    loginit($yearmonth . 'banlog');
    dir_clear('./forumdata/templates');
    dir_clear('./forumdata/cache');
    dir_clear('./forumdata/threadcaches');
    @touch(DISCUZ_ROOT . $lockfile);
    echo '<script type="text/javascript">document.getElementById("laststep").disabled = false; </script>' . "\r\n";
    echo '<script type="text/javascript">document.getElementById("laststep").value = \'' . $lang['install_succeed'] . '\'; </script>' . "\r\n";
    echo '<iframe width="0" height="0" src="index.php"></iframe>';
}
开发者ID:jonycookie,项目名称:projectm2,代码行数:31,代码来源:install.php

示例13: loginit

    echo "          </td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    echo "            <hr noshade align=\"center\" width=\"100%\" size=\"1\">\n";
    echo "          </td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td><b><font color=\"#FF0000\">&gt;</font><font color=\"#000000\"> {$lang['init_file']}</font></b></td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    loginit('adminlog');
    loginit('errorlog');
    dir_clear('./askdata/templates');
    dir_clear('./askdata/cache');
    @touch($lockfile);
    ?>
          </td>
        </tr>
        <tr>
          <td>
            <hr noshade align="center" width="100%" size="1">
          </td>
        </tr>
        <tr>
          <td align="center">
            <font color="#FF0000"><b><?php 
    echo $lang['install_succeed'];
    ?>
</font><br>
开发者ID:yunsite,项目名称:cyaskuc,代码行数:31,代码来源:install.php

示例14: showjsmessage

        for ($i = 0; $i < 5; $i++) {
            showjsmessage('正在设置系统...成功!');
        }
        for ($i = 0; $i < 5; $i++) {
            showjsmessage('正在导入区划数据...');
        }
        install_districtdata();
        for ($i = 0; $i < 5; $i++) {
            showjsmessage('正在导入区划数据...成功!');
        }
        $yearmonth = date('Ym_', time());
        loginit($yearmonth . 'illegallog');
        loginit($yearmonth . 'cplog');
        loginit($yearmonth . 'errorlog');
        dir_clear(ROOT_PATH . './data/template');
        dir_clear(ROOT_PATH . './data/cache');
        foreach ($serialize_sql_setting as $k => $v) {
            $v = addslashes(serialize($v));
            $db->query("REPLACE INTO {$tablepre}setting VALUES ('{$k}', '{$v}')");
        }
        if ($runqueryerror) {
            showjsmessage('<span class="red">' . $lang['error_quit_msg'] . '</span>');
            exit;
        }
        showjsmessage('系统数据安装成功!请点击下一步设置管理员</span>');
        echo '<script type="text/javascript">function setlaststep() {document.getElementById("laststep").disabled=false;}</script><script type="text/javascript">setTimeout(function(){window.location=\'index.php?step=4\'}, 30000);setlaststep();</script>' . "\r\n";
        show_footer();
    }
    show_form($form_db_init_items, $error_msg);
} elseif ($method == 'admin_init') {
    $submit = true;
开发者ID:druphliu,项目名称:dzzoffice,代码行数:31,代码来源:index.php

示例15: fopen

    echo $installfile;
    ?>
">
<input type="hidden" name="action" value="user">
<input type="button" name="submit" value="下一步" disabled style="height: 25" onclick="window.location='installer.php?action=user'" id="laststep">
</form>
<br>
</td></tr>
<?php 
    $fp = fopen($sqlfile, 'rb');
    $sql = fread($fp, filesize($sqlfile));
    fclose($fp);
    runquery($sql);
    runquery($extrasql);
    dir_clear('./data/templates');
    dir_clear('./data/cache');
    echo '<script type="text/javascript">document.getElementById("laststep").disabled = false; </script>' . "\r\n";
    echo '<script type="text/javascript">document.getElementById("laststep").value = \'下一步\'; </script>' . "\r\n";
} elseif ($action == 'user') {
    $db = new dbstuff();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $db->select_db($dbname);
    $query = $db->query("SELECT * FROM {$tablepre}members WHERE uid='1 Babel'");
    if (mysql_num_rows($query) > 0) {
        showjsmessage('用户已经创建,请继续安装');
    } else {
        if ($_POST['saveconfig']) {
            $username = strtolower(addslashes(trim(stripslashes($_POST['username']))));
            $email = htmlspecialchars($_POST['email']);
            $password = md5($_POST['password']);
            $db->query("INSERT INTO {$tablepre}members (username, password, adminid, groupid, regip, regdate, lastvisit, lastactivity,  email, dateformat, timeformat, timeoffset ,avatar)\r\n\t\t\t\tVALUES ('{$username}', '{$password}', '1', '1',  'hidden', '{$timestamp}', '{$timestamp}', '{$timestamp}', '{$email}',  '0000-00-00', '0', '9999', '')");
开发者ID:royburns,项目名称:project-nowhere,代码行数:31,代码来源:installer.php


注:本文中的dir_clear函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。