• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP rmdirs函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: rmdirs

/**
 * 删除指定目录及其下的所有文件和子目录
 *
 * 用法:
 * <code>
 * // 删除 my_dir 目录及其下的所有文件和子目录
 * rmdirs('/path/to/my_dir');
 * </code>
 *
 * 注意:使用该函数要非常非常小心,避免意外删除重要文件。
 *
 * @param string $dir
 */
function rmdirs($dir)
{
    $dir = realpath($dir);
    if ($dir == '' || $dir == '/' || strlen($dir) == 3 && substr($dir, 1) == ':\\') {
        // 禁止删除根目录
        return false;
    }
    // 遍历目录,删除所有文件和子目录
    if (false !== ($dh = opendir($dir))) {
        while (false !== ($file = readdir($dh))) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            $path = $dir . DIRECTORY_SEPARATOR . $file;
            if (is_dir($path)) {
                if (!rmdirs($path)) {
                    return false;
                }
            } else {
                unlink($path);
            }
        }
        closedir($dh);
        rmdir($dir);
        return true;
    } else {
        return false;
    }
}
开发者ID:BGCX261,项目名称:zlskytakeorder-svn-to-git,代码行数:42,代码来源:FileSystem.php


示例2: rmdirs

function rmdirs($dir)
{
    if ($objs = glob($dir . '/*')) {
        foreach ($objs as $obj) {
            is_dir($obj) ? rmdirs($obj) : unlink($obj);
        }
    }
    rmdir($dir);
}
开发者ID:mleo1,项目名称:rAFluxCP,代码行数:9,代码来源:get.php


示例3: delete

 /**
  * 删除
  */
 public function delete($time, $md5, $path)
 {
     if ($this->md5($time, $md5)) {
         if ($path) {
             return rmdirs($path);
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:Orchild,项目名称:mt,代码行数:14,代码来源:UpdateApiController.class.php


示例4: rmdirs

/**
 * 删除目录(递归删除内容)
 * @param string $path 目录位置
 * @param bool $clean 不删除目录,仅删除目录内文件
 * @return bool
 */
function rmdirs($path, $clean=false) {
	if(!is_dir($path)) {
		return false;
	}
	$files = glob($path . '/*');
	if($files) {
		foreach($files as $file) {
			is_dir($file) ? rmdirs($file) : @unlink($file);
		}
	}
	return $clean ? true : @rmdir($path);
}
开发者ID:royalwang,项目名称:saivi,代码行数:18,代码来源:file.func.php


示例5: rmdirs

function rmdirs($dir)
{
    $d = dir($dir);
    while (false !== ($child = $d->read())) {
        if ($child != '.' && $child != '..') {
            if (is_dir($dir . '/' . $child)) {
                rmdirs($dir . '/' . $child);
            } else {
                unlink($dir . '/' . $child);
            }
        }
        $d->close();
        rmdir($dir);
    }
}
开发者ID:qinquanxing,项目名称:huaxia,代码行数:15,代码来源:function.common.php


示例6: update_html

/**
 * HTML データを作成する。
 */
function update_html($trg, $lines)
{
    global $x0401;
    global $x0402;
    $tmp = PATH_TMP . "/" . preg_replace("/.*\\//", "", $trg);
    rmdirs(array($tmp));
    mkdirs(array($tmp));
    update_html_prefs($tmp);
    update_html_cities($tmp);
    update_html_meta($tmp);
    foreach ($x0402 as $code => $city_name) {
        update_html_detail($tmp, $code, $city_name, $lines);
    }
    log_info("Updated  : " . $tmp . "/??/???.html");
    move_data($tmp, $trg);
    return true;
}
开发者ID:BGCX261,项目名称:zippyzipjp-svn-to-git,代码行数:20,代码来源:zippyzip-html.php


示例7: rmdirs

 public function rmdirs($dir)
 {
     //error_reporting(0);    函数会返回一个状态,我用error_reporting(0)屏蔽掉输出
     //rmdir函数会返回一个状态,我用@屏蔽掉输出
     $dir_arr = scandir($dir);
     foreach ($dir_arr as $key => $val) {
         if ($val == '.' || $val == '..' || $val == '.svn') {
         } else {
             if (is_dir($dir . '/' . $val)) {
                 if (@rmdir($dir . '/' . $val) == 'true') {
                 } else {
                     rmdirs($dir . '/' . $val);
                 }
             } else {
                 unlink($dir . '/' . $val);
             }
         }
     }
 }
开发者ID:mamtou,项目名称:wavephp,代码行数:19,代码来源:FileClass.php


示例8: rmdirs

 function rmdirs($dir, $counter = 0)
 {
     if (is_dir($dir)) {
         $dir = realpath($dir) . DIRECTORY_SEPARATOR;
     }
     if ($dh = opendir($dir)) {
         while (($f = readdir($dh)) !== false) {
             if ($f != '.' && $f != '..') {
                 $f = $dir . $f;
                 if (@is_dir($f)) {
                     $counter += rmdirs($f);
                 } else {
                     if (unlink($f)) {
                         $counter++;
                     }
                 }
             }
         }
         closedir($dh);
         if (rmdir($dir)) {
             $counter++;
         }
     }
     return $counter;
 }
开发者ID:retanoj,项目名称:webshellSample,代码行数:25,代码来源:7394316867fbf40088309b5150e77721.php


示例9: cache_build_template

function cache_build_template()
{
    //更新模板
    rmdirs(IA_ROOT . '/data/tpl', true);
}
开发者ID:yunsite,项目名称:my-we7,代码行数:5,代码来源:cache.mod.php


示例10: message

         message($r['message'], url('cloud/profile'), 'error');
     }
     $info = cloud_m_upgradeinfo($id);
     if ($_W['isajax'] && $type == 'getinfo') {
         message($info, '', 'ajax');
     }
     if (is_error($info)) {
         message($info['message'], referer(), 'error');
     }
     if (!is_error($info)) {
         if (empty($_GPC['flag'])) {
             if (intval($_GPC['branch']) > $info['version']['branch_id']) {
                 header('location: ' . url('cloud/redirect/buybranch', array('m' => $id, 'branch' => intval($_GPC['branch']), 'is_upgrade' => 1)));
                 exit;
             }
             rmdirs($modulepath, true);
             header('location: ' . url('cloud/process', array('m' => $id, 'is_upgrade' => 1)));
             exit;
         } else {
             define('ONLINE_MODULE', true);
             $packet = cloud_m_build($id);
             $manifest = ext_module_manifest_parse($packet['manifest']);
         }
     }
 }
 if (empty($manifest)) {
     message('模块安装配置文件不存在或是格式不正确!', '', 'error');
 }
 manifest_check($id, $manifest);
 if (ver_compare($module['version'], $manifest['application']['version']) != -1) {
     message('已安装的模块版本不低于要更新的版本, 操作无效.');
开发者ID:zhang19960118,项目名称:html11,代码行数:31,代码来源:module.ctrl.php


示例11: unset

                            break;
                        }
                        if ($f['download']) {
                            $success++;
                        }
                    }
                    unset($f);
                    $upgrade['files'] = $files;
                    $tmpdir = IA_ROOT . '/addons/ewei_shop/' . date('ymd');
                    if (!is_dir($tmpdir)) {
                        mkdirs($tmpdir);
                    }
                    file_put_contents($tmpdir . '/file.txt', json_encode($upgrade));
                    die(json_encode(array('result' => 1, 'total' => count($files), 'success' => $success . '(' . $path . ')')));
                }
            } else {
                if (!empty($upgrade['upgrade'])) {
                    $updatefile = IA_ROOT . '/addons/ewei_shop/upgrade.php';
                    file_put_contents($updatefile, base64_decode($upgrade['upgrade']));
                    require $updatefile;
                    @unlink($updatefile);
                }
                file_put_contents(IA_ROOT . '/addons/ewei_shop/version.php', '<?php if(!defined(\'IN_IA\')) {exit(\'Access Denied\');}if(!defined(\'EWEI_SHOP_VERSION\')) {define(\'EWEI_SHOP_VERSION\', \'' . $upgrade['version'] . '\');}');
                $tmpdir = IA_ROOT . '/addons/ewei_shop/' . date('ymd');
                @rmdirs($tmpdir);
                die(json_encode(array('result' => 2)));
            }
        }
    }
}
include $this->template('web/sysset/upgrade');
开发者ID:ChainBoy,项目名称:wxfx,代码行数:31,代码来源:upgrade.php


示例12: rmdirs

function rmdirs($d)
{
    $f = glob($d . '*', GLOB_MARK);
    foreach ($f as $z) {
        if (is_dir($z)) {
            rmdirs($z);
        } else {
            unlink($z);
        }
    }
    if (is_dir($d)) {
        rmdir($d);
    }
}
开发者ID:mcanv,项目名称:webshell,代码行数:14,代码来源:b374k-2.2.php


示例13: foreach

     if (compress($massType, $massValue, $massBufferArr)) {
         $counter++;
         return $counter;
     }
 } else {
     foreach ($massBufferArr as $k) {
         $path = trim($k);
         if (file_exists($path)) {
             $preserveTimestamp = filemtime($path);
             if ($massType == 'delete') {
                 if (is_file($path)) {
                     if (unlink($path)) {
                         $counter++;
                     }
                 } elseif (is_dir($path)) {
                     if (rmdirs($path) > 0) {
                         $counter++;
                     }
                 }
             } elseif ($massType == 'cut') {
                 $dest = $massPath . basename($path);
                 if (rename($path, $dest)) {
                     $counter++;
                     touch($dest, $preserveTimestamp);
                 }
             } elseif ($massType == 'copy') {
                 $dest = $massPath . basename($path);
                 if (is_dir($path)) {
                     if (copys($path, $dest) > 0) {
                         $counter++;
                     }
开发者ID:lionsoft,项目名称:b374k,代码行数:31,代码来源:base.php


示例14: ca

<?php

global $_W, $_GPC;
//check_shop_auth('http://120.26.212.219/api.php', $this -> pluginname);
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
if ($operation == 'display') {
    ca('poster.view');
    if (checksubmit('submit')) {
        ca('poster.clear');
        load()->func('file');
        @rmdirs(IA_ROOT . '/addons/ewei_shop/data/poster/' . $_W['uniacid']);
        @rmdirs(IA_ROOT . '/addons/ewei_shop/data/qrcode/' . $_W['uniacid']);
        $acid = pdo_fetchcolumn("SELECT acid FROM " . tablename('account_wechats') . " WHERE `uniacid`=:uniacid LIMIT 1", array(':uniacid' => $_W['uniacid']));
        pdo_update('ewei_shop_poster_qr', array('mediaid' => ''), array('acid' => $acid));
        plog('poster.clear', '清除海报缓存');
        message('缓存清除成功!', referer(), 'success');
    }
    $pindex = max(1, intval($_GPC['page']));
    $psize = 10;
    $params = array(':uniacid' => $_W['uniacid']);
    $condition = " and uniacid=:uniacid ";
    if (!empty($_GPC['keyword'])) {
        $_GPC['keyword'] = trim($_GPC['keyword']);
        $condition .= ' AND `title` LIKE :title';
        $params[':title'] = '%' . trim($_GPC['keyword']) . '%';
    }
    if (!empty($_GPC['type'])) {
        $condition .= ' AND `type` = :type';
        $params[':type'] = intval($_GPC['type']);
    }
    $list = pdo_fetchall("SELECT * FROM " . tablename('ewei_shop_poster') . " WHERE 1 {$condition} ORDER BY isdefault desc,createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $params);
开发者ID:noikiy,项目名称:mygit,代码行数:31,代码来源:index.php


示例15: array

    exit;
}
if (!empty($packet) && (!empty($packet['upgrade']) || !empty($packet['install']))) {
    $schemas = array();
    if (!empty($packet['schemas'])) {
        foreach ($packet['schemas'] as $schema) {
            $schemas[] = substr($schema['tablename'], 4);
        }
    }
    $scripts = array();
    if (empty($packet['install'])) {
        $updatefiles = array();
        if (!empty($packet['scripts'])) {
            $updatedir = IA_ROOT . '/data/update/';
            load()->func('file');
            rmdirs($updatedir, true);
            mkdirs($updatedir);
            $cversion = IMS_VERSION;
            $crelease = IMS_RELEASE_DATE;
            foreach ($packet['scripts'] as $script) {
                if ($script['release'] <= $crelease) {
                    continue;
                }
                $fname = "update({$crelease}-{$script['release']}).php";
                $crelease = $script['release'];
                $script['script'] = @base64_decode($script['script']);
                if (empty($script['script'])) {
                    $script['script'] = <<<DAT
<?php
load()->model('setting');
setting_upgrade_version('{$packet['family']}', '{$script['version']}', '{$script['release']}');
开发者ID:eduNeusoft,项目名称:weixin,代码行数:31,代码来源:process.ctrl.php


示例16: cache_clean

function cache_clean($dir = '')
{
    $dir = $dir ? "{$GLOBALS['config']['cache']['dir']}/{$dir}" : "{$GLOBALS['config']['cache']['dir']}";
    rmdirs($dir, true);
}
开发者ID:legeng,项目名称:project-2,代码行数:5,代码来源:cache.file.func.php


示例17: step3

function step3()
{
    if (!@rmdirs(DIAMONDMVC_ROOT . DS . 'firstinstallation')) {
        include dirname(__FILE__) . '/step3.php';
    } else {
        redirect(DIAMONDMVC_URL);
    }
}
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:8,代码来源:index.php


示例18: rmdirs

/**
 * Recurrsively removes everything in the given path, i.e. all files and subdirectories within the
 * given directory.
 * @param  string  $path
 * @return boolean True if the directory was successfully deleted, otherwise false. In case of an error, see the logs.
 */
function rmdirs($path)
{
    // Make sure the file even is a file. :I
    if (!is_dir($path)) {
        logMsg('rmdirs: attempted to recurrsively remove directories in path ' . $path . ', but its not a directory!', 5, 5);
        return false;
    }
    // Make directory separators platform-specifically uniform.
    $files = glob("{$path}/*");
    foreach ($files as $file) {
        if (is_dir($file)) {
            rmdirs($file);
        } else {
            unlink($file);
        }
    }
    if (!is_dir_empty($path)) {
        logMsg('rmdirs: failed to delete everything in the directory', 5, 5);
        return false;
    }
    return rmdir($path);
}
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:28,代码来源:fns.php


示例19: pdo_delete

        }
    }
    pdo_delete('rule', "id IN ('" . implode("','", $deleteid) . "')");
}
$subaccount = pdo_fetchall("SELECT acid FROM " . tablename('account') . " WHERE uniacid = :uniacid", array(':uniacid' => $id));
if (!empty($subaccount)) {
    foreach ($subaccount as $account) {
        @unlink(IA_ROOT . '/attachment/qrcode_' . $account['acid'] . '.jpg');
        @unlink(IA_ROOT . '/attachment/headimg_' . $account['acid'] . '.jpg');
    }
    $acid = intval($_GPC['acid']);
    if (empty($acid)) {
        load()->func('file');
        rmdirs(IA_ROOT . '/attachment/images/' . $id);
        @rmdir(IA_ROOT . '/attachment/images/' . $id);
        rmdirs(IA_ROOT . '/attachment/audios/' . $id);
        @rmdir(IA_ROOT . '/attachment/audios/' . $id);
    }
}
$tables = pdo_fetchall("SHOW TABLES;");
if (!empty($tables)) {
    foreach ($tables as $table) {
        $table = array_shift($table);
        if (strpos($table, $GLOBALS['_W']['config']['db']['tablepre']) !== 0) {
            continue;
        }
        $tablename = str_replace($GLOBALS['_W']['config']['db']['tablepre'], '', $table);
        if (pdo_fieldexists($tablename, 'uniacid')) {
            pdo_delete($tablename, array('uniacid' => $id));
        }
        if (pdo_fieldexists($tablename, 'weid')) {
开发者ID:keycoolkui,项目名称:weixinfenxiao,代码行数:31,代码来源:delete.ctrl.php


示例20: rmdirs

function rmdirs($s)
{
    $s = substr($s, -1) == '/' ? $s : $s . '/';
    if ($dh = opendir($s)) {
        while (($f = readdir($dh)) !== false) {
            if ($f != '.' && $f != '..') {
                $f = $s . $f;
                if (@is_dir($f)) {
                    rmdirs($f);
                } else {
                    @unlink($f);
                }
            }
        }
        closedir($dh);
        @rmdir($s);
    }
}
开发者ID:engmohamedamer,项目名称:gotest,代码行数:18,代码来源:dl.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP running_script函数代码示例发布时间:2022-05-24
下一篇:
PHP rmdirr函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap