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


PHP delDirAndFile函数代码示例

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


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

示例1: appUninstall

 public function appUninstall()
 {
     /*
      * 更新数据库
      * **/
     $uninstallSql = sprintf("%s/apps/%s/data/sqls/uninstall.sql", ROOT_PATH, $this->appConfig["alias"]);
     if (is_file($uninstallSql)) {
         $rs = importSQL($uninstallSql);
         //            if(true !== $rs) {
         //                $this->error = $rs[0];
         //                return false;
         //            }
     }
     /*
      * 删除APP目录
      * **/
     delDirAndFile($this->appPath);
     rmdir($this->appPath);
     if ($this->workflows) {
         $this->appDeleteWorkflow($this->workflows);
     }
     if ($this->authNodes) {
         $model = D("AuthRule");
         $model->where(array("category" => $this->appConfig["alias"]))->delete();
     }
     if (is_dir($this->appPath)) {
         //$this->error("uninstall failed when remove the app dir");
     }
     return true;
     /*
      * 其他扩展文件
      * @todo
      * **/
 }
开发者ID:bqx619,项目名称:ones_dev,代码行数:34,代码来源:CommonBuildAction.class.php

示例2: cache_clean

 /**
  * 清理缓存,待完善
  */
 public function cache_clean()
 {
     echo "<span style='color: red;'>缓存清理中……</span><br/>";
     $path = RUNTIME_PATH . "Cache/";
     echo delDirAndFile($path);
     echo "<br/><span style='color: red;'>缓存清理完毕。</span>";
 }
开发者ID:WALES7CH,项目名称:TP-Admin,代码行数:10,代码来源:IndexController.class.php

示例3: index

 public function index()
 {
     $caches = array("HomeCache" => array("name" => "网站前台缓存文件", "path" => ROOT_PATH . C("DEFAULT_GROUP") . "/Runtime/"), "AdminCache" => array("name" => "网站后台缓存文件", "path" => ROOT_PATH . "Admin/Runtime/"));
     foreach ($caches as $val) {
         if (isset($val['path'])) {
             delDirAndFile($val['path']);
         }
     }
     $this->success('缓存清理成功!', __MODULE__ . '/Main/index');
 }
开发者ID:9618211,项目名称:TP-Admin-V2.0,代码行数:10,代码来源:CacheController.class.php

示例4: clear

 public function clear()
 {
     if (IS_POST) {
         $PATHs = $_REQUEST['delids'];
         $arrPath = str2arr($PATHs, ',');
         foreach ($arrPath as $path) {
             //var_dump(delDirAndFile($path));
             delDirAndFile($path);
         }
         $this->ajaxReturn(array("status" => 200, "message" => "缓存文件已清除"));
     }
 }
开发者ID:siimanager,项目名称:sii,代码行数:12,代码来源:ClearcacheController.class.php

示例5: delDirAndFile

function delDirAndFile($dirName)
{
    if (is_dir($dirName)) {
        $handle = @opendir("{$dirName}");
        while ($item = @readdir($handle)) {
            if ($item != "." && $item != "..") {
                delDirAndFile("{$dirName}/{$item}");
            }
        }
        @closedir($handle);
        @rmdir($dirName);
    } else {
        @unlink($dirName);
    }
}
开发者ID:xing393939,项目名称:uploadBigFile,代码行数:15,代码来源:api_cli_crontab.php

示例6: delFileUnderDir

function delFileUnderDir($dirName)
{
    if ($handle = opendir("{$dirName}")) {
        while (false !== ($item = readdir($handle))) {
            if ($item != "." && $item != "..") {
                if (is_dir("{$dirName}/{$item}")) {
                    delDirAndFile("{$dirName}/{$item}");
                } else {
                    unlink("{$dirName}/{$item}");
                }
            }
        }
        closedir($handle);
        //rmdir($dirName);
    }
}
开发者ID:node-rookie,项目名称:bdg,代码行数:16,代码来源:Update.class.php

示例7: _initialize

 /**
  +----------------------------------------------------------
 * 初始化
 * 如果 继承本类的类自身也需要初始化那么需要在使用本继承类的类里使用parent::_initialize();
  +----------------------------------------------------------
 */
 public function _initialize()
 {
     header("Content-Type:text/html; charset=utf-8");
     header('Content-Type:application/json; charset=utf-8');
     $systemConfig = (include WEB_ROOT . 'Common/systemConfig.php');
     if (empty($systemConfig['TOKEN']['admin_marked'])) {
         $systemConfig['TOKEN']['admin_marked'] = "QQ群:102577846";
         $systemConfig['TOKEN']['admin_timeout'] = 3600;
         $systemConfig['TOKEN']['member_marked'] = "http://blog.51edm.org";
         $systemConfig['TOKEN']['member_timeout'] = 3600;
         F("systemConfig", $systemConfig, WEB_ROOT . "Common/");
         if (is_dir(WEB_ROOT . "install/")) {
             delDirAndFile(WEB_ROOT . "install/", TRUE);
         }
     }
     $this->loginMarked = md5($systemConfig['TOKEN']['admin_marked']);
     $this->checkLogin();
     // 用户权限检查
     if (C('USER_AUTH_ON') && !in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODULE')))) {
         import('ORG.Util.RBAC');
         if (!RBAC::AccessDecision()) {
             //检查认证识别号
             if (!$_SESSION[C('USER_AUTH_KEY')]) {
                 //跳转到认证网关
                 redirect(C('USER_AUTH_GATEWAY'));
                 //                    redirect(PHP_FILE . C('USER_AUTH_GATEWAY'));
             }
             // 没有权限 抛出错误
             if (C('RBAC_ERROR_PAGE')) {
                 // 定义权限错误页面
                 redirect(C('RBAC_ERROR_PAGE'));
             } else {
                 if (C('GUEST_AUTH_ON')) {
                     $this->assign('jumpUrl', C('USER_AUTH_GATEWAY'));
                 }
                 // 提示错误信息
                 //                     echo L('_VALID_ACCESS_');
                 $this->error(L('_VALID_ACCESS_'));
             }
         }
     }
     $this->assign("menu", $this->show_menu());
     $this->assign("sub_menu", $this->show_sub_menu());
     $this->assign("my_info", $_SESSION['my_info']);
     $this->assign("site", $systemConfig);
     $this->getQRCode();
 }
开发者ID:slyfalcon,项目名称:PHP-Amateur_Common_System,代码行数:53,代码来源:CommonAction.class.php

示例8: updatenow

    public function updatenow(){
        include('Update.class.php');
        $version = './WQLData/version.php';
        $ver = include($version);
        $ver = $ver['ver'];
		
		
       
		
        $hosturl = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
        $updatehost = 'http://demo.weiqianlong.com/update.php';
        $updatehosturl = $updatehost . '?a=update&v=' . $ver . '&u=' . $hosturl;
		
		
		
        $updatenowinfo = file_get_contents($updatehosturl);
		
		
        if (strstr($updatenowinfo, 'zip')){
            $pathurl = $updatehost . '?a=down&f=' . $updatenowinfo;
            $updatedir = './WQLData/logs/Temp/update';
            delDirAndFile($updatedir);
            get_file($pathurl, $updatenowinfo, $updatedir);
            $updatezip = $updatedir . '/' . $updatenowinfo;
            $archive = new PclZip($updatezip);
            if ($archive -> extract(PCLZIP_OPT_PATH, './', PCLZIP_OPT_REPLACE_NEWER) == 0){
                $updatenowinfo = "远程升级文件不存在.升级失败</font>";
            }else{
                $sqlfile = $updatedir . '/update.sql';
                $sql = file_get_contents($sqlfile);
                if($sql){
                    $sql = str_replace("tp_", C('DB_PREFIX'), $sql);
                    $Model = new Model();
                    error_reporting(0);
                    foreach(split(";[\r\n]+", $sql) as $v){
                        @mysql_query($v);
                    }
                }
                $updatenowinfo = "<font color=red>升级完成 {$sqlinfo}</font><span><a href=./index.php?g=System&m=Update>点击这里 查看是否还有升级包</a></span>";
            }
        }
        delDirAndFile($updatedir);
        $this -> assign('updatenowinfo', $updatenowinfo);
        $this -> display();
    }
开发者ID:royalwang,项目名称:saivi,代码行数:45,代码来源:UpdateAction.class.php

示例9: delDirAndFile

function delDirAndFile($dirName)
{
    if ($handle = opendir($dirName)) {
        while (false !== ($item = readdir($handle))) {
            if ($item != "." && $item != "..") {
                if (is_dir($dirName . '/' . $item)) {
                    delDirAndFile($dirName . '/' . $item);
                } else {
                    if (unlink($dirName . '/' . $item)) {
                    }
                }
            }
        }
        closedir($handle);
        if (rmdir($dirName)) {
        }
    }
}
开发者ID:zhangzhengyu,项目名称:ThinkSAAS,代码行数:18,代码来源:update.php

示例10: delDirAndFile

 /**
 * 删除目录及目录下所有文件或删除指定文件
 * @param str $path   待删除目录路径
 * @param int $delDir 是否删除目录,1或true删除目录,0或false则只删除文件保留目录(包含子目录)
 * @return bool 返回删除状态
 */
 protected function delDirAndFile($path, $delDir = FALSE)
 {
     $message = "";
     $handle = opendir($path);
     if ($handle) {
         while (false !== ($item = readdir($handle))) {
             if ($item != "." && $item != "..") {
                 if (is_dir("{$path}/{$item}")) {
                     $msg = delDirAndFile("{$path}/{$item}", $delDir);
                     if ($msg) {
                         $message .= $msg;
                     }
                 } else {
                     $message .= "删除文件" . $item;
                     if (unlink("{$path}/{$item}")) {
                         $message .= "成功<br />";
                     } else {
                         $message .= "失败<br />";
                     }
                 }
             }
         }
         closedir($handle);
         if ($delDir) {
             if (rmdir($path)) {
                 $message .= "删除目录" . dirname($path) . "<br />";
             } else {
                 $message .= "删除目录" . dirname($path) . "失败<br />";
             }
         }
     } else {
         if (file_exists($path)) {
             if (unlink($path)) {
                 $message .= "删除文件" . basename($path) . "<br />";
             } else {
                 $message .= "删除文件" + basename($path) . "失败<br />";
             }
         } else {
             $message .= "文件" + basename($path) . "不存在<br />";
         }
     }
     return $message;
 }
开发者ID:jws132,项目名称:sjcrm,代码行数:49,代码来源:CacheController.class.php

示例11: delDirAndFile

function delDirAndFile($dirName)
{
    if ($handle = opendir("{$dirName}")) {
        while (false !== ($item = readdir($handle))) {
            if ($item != "." && $item != "..") {
                if (is_dir("{$dirName}/{$item}")) {
                    delDirAndFile("{$dirName}/{$item}");
                } else {
                    if (unlink("{$dirName}/{$item}")) {
                        echo "成功删除文件: {$dirName}/{$item}<br />\n";
                    }
                }
            }
        }
        closedir($handle);
        if (rmdir($dirName)) {
            echo "成功删除目录: {$dirName}<br />\n";
        }
    }
}
开发者ID:seco,项目名称:53to,代码行数:20,代码来源:runall.php

示例12: delDirAndFile

function delDirAndFile($dirName, $echo = 1, $echotxt = '更新缓存')
{
    if ($handle = opendir("{$dirName}")) {
        while (false !== ($item = readdir($handle))) {
            if ($item != "." && $item != "..") {
                if (is_dir("{$dirName}/{$item}")) {
                    delDirAndFile("{$dirName}/{$item}");
                } else {
                    if (unlink("{$dirName}/{$item}") && $echo == 1) {
                        echo $echotxt . ": {$dirName}/{$item}<br />\n";
                    }
                }
            }
        }
        closedir($handle);
        if (rmdir($dirName) && $echo == 1) {
            echo $echotxt . ": {$dirName}<br />\n";
        }
    }
    return TRUE;
}
开发者ID:liutongju,项目名称:DreamCMSCN,代码行数:21,代码来源:function.php

示例13: delDirAndFile

function delDirAndFile($dirName, $root)
{
    $rootfolder = $root;
    if ($handle = opendir("{$dirName}")) {
        while (false !== ($item = readdir($handle))) {
            if ($item != "." && $item != "..") {
                if (is_dir("{$dirName}/{$item}")) {
                    delDirAndFile("{$dirName}/{$item}", $root);
                } else {
                    if (unlink("{$dirName}/{$item}")) {
                        echo "成功删除文件: {$dirName}/{$item}\\</br>";
                    }
                }
            }
        }
        closedir($handle);
        if ($dirName != $rootfolder . '/Cache' && $dirName != $rootfolder . '/Temp' && $dirName != $rootfolder . '/Data') {
            if (rmdir($dirName)) {
                echo "成功删除目录: {$dirName}\n";
            }
        }
    }
}
开发者ID:cy520win,项目名称:yunchao,代码行数:23,代码来源:delhc.php

示例14: checkSystemConfig

 /**
  +----------------------------------------------------------
 * 网站配置信息保存操作等
  +----------------------------------------------------------
 */
 private function checkSystemConfig($obj = "SITE_INFO")
 {
     if (IS_POST) {
         $this->checkToken();
         $config = WEB_ROOT . "Common/systemConfig.php";
         $config = file_exists($config) ? include "{$config}" : array();
         $config = is_array($config) ? $config : array();
         $config = array_merge($config, array("{$obj}" => $_POST));
         $str = $obj == "SITE_INFO" ? "网站配置信息" : $obj == "SYSTEM_EMAIL" ? "系统邮箱配置" : "安全设置";
         if (F("systemConfig", $config, WEB_ROOT . "Common/")) {
             delDirAndFile(WEB_CACHE_PATH . "Runtime/Admin/~runtime.php");
             if ($obj == "TOKEN") {
                 unset($_SESSION, $_COOKIE);
                 echo json_encode(array('status' => 1, 'info' => $str . '已更新,你需要重新登录', 'url' => __APP__ . '?' . time()));
             } else {
                 echo json_encode(array('status' => 1, 'info' => $str . '已更新'));
             }
         } else {
             echo json_encode(array('status' => 0, 'info' => $str . '失败,请检查', 'url' => __ACTION__));
         }
     } else {
         $this->display();
     }
 }
开发者ID:slyfalcon,项目名称:PHP-Amateur_Common_System,代码行数:29,代码来源:WebinfoAction.class.php

示例15: cache

 public function cache()
 {
     //        $caches = array(
     //            "allCache" => WEB_CACHE_PATH,
     //            "allRunCache" => WEB_CACHE_PATH . "Runtime/",
     //            "allAdminRunCache" => WEB_CACHE_PATH . "Runtime/Admin/",
     //            "allHomeRunCache" => WEB_CACHE_PATH . "Runtime/Home/",
     //            "allHomeRunCache" => WEB_CACHE_PATH . "Runtime/Home/",
     //        );
     $caches = array("HomeCache" => array("name" => "网站前台缓存文件", "path" => WEB_CACHE_PATH . "Home/Cache/"), "AdminCache" => array("name" => "网站后台缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Cache/"), "HomeData" => array("name" => "网站前台数据库字段缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/Data/"), "AdminData" => array("name" => "网站后台数据库字段缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Data/"), "HomeLog" => array("name" => "网站前台日志缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/Logs/"), "AdminLog" => array("name" => "网站后台日志缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Logs/"), "HomeTemp" => array("name" => "网站前台临时缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/Temp"), "AdminTemp" => array("name" => "网站后台临时缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Temp"), "Homeruntime" => array("name" => "网站前台runtime.php缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/~runtime.php"), "Adminruntime" => array("name" => "网站后台runtime.php缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/~runtime.php"), "MinFiles" => array("name" => "JS\\CSS压缩缓存文件", "path" => WEB_CACHE_PATH . "MinFiles/"));
     if (IS_POST) {
         foreach ($_POST['cache'] as $path) {
             if (isset($caches[$path])) {
                 delDirAndFile($caches[$path]['path']);
             }
         }
         //            pre($_POST);
         //            $this->checkToken();
         echo json_encode(array("status" => 1, "info" => "缓存文件已清除"));
     } else {
         $this->assign("caches", $caches);
         $this->display();
     }
 }
开发者ID:slyfalcon,项目名称:PHP-Amateur_Common_System,代码行数:24,代码来源:IndexAction.class.php


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