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


PHP RecursiveFolderDelete函数代码示例

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


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

示例1: RecursiveFolderDelete

function RecursiveFolderDelete($folderPath)
{
    if (is_dir($folderPath)) {
        foreach (scandir($folderPath) as $value) {
            if ($value != "." && $value != "..") {
                $value = $folderPath . "/" . $value;
                if (is_dir($value)) {
                    RecursiveFolderDelete($value);
                } elseif (is_file($value)) {
                    @unlink($value);
                }
            }
        }
        if (!@rmdir($folderPath)) {
            return FALSE;
        } else {
            return TRUE;
        }
    } else {
        return FALSE;
    }
}
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:22,代码来源:functions.php

示例2: RecursiveFolderDelete

function RecursiveFolderDelete($folderPath)
{
    // from http://www.php.net/manual/en/function.rmdir.php
    if (trailingslashit(constant('ABSPATH')) == trailingslashit($folderPath)) {
        return false;
    }
    if (@is_dir($folderPath)) {
        $dh = @opendir($folderPath);
        while (false !== ($value = @readdir($dh))) {
            if ($value != "." && $value != "..") {
                $value = $folderPath . "/" . $value;
                if (@is_dir($value)) {
                    RecursiveFolderDelete($value);
                }
            }
        }
        return @rmdir($folderPath);
    } else {
        return FALSE;
    }
}
开发者ID:alx,项目名称:alexgirard.com-blog,代码行数:21,代码来源:wp-cache.php

示例3: urlencode

 }
 if ($_GET['do'] == 'delete' && $_GET['file'] && $_GET['type'] == 'file') {
     if (file_exists($current_folder . $_GET['file'])) {
         if (!@unlink($current_folder . $_GET['file'])) {
             $alert_info = "You cannot delete this file\\nThe relevant permissions must permit this.";
         } else {
             $alert_info = "File deleted";
             $redirect = "file_manager.php?p=" . urlencode($current_folder);
         }
     } else {
         $alert_info = "You cannot delete this file\\nInvalid file";
     }
 }
 if ($_GET['do'] == 'delete' && $_GET['file'] && $_GET['type'] == 'directory') {
     if (file_exists($current_folder . $_GET['file'])) {
         if (!RecursiveFolderDelete($current_folder . $_GET['file'])) {
             $alert_info = "You cannot delete this directory\\nThe relevant permissions must permit this.";
         } else {
             $alert_info = "Folder deleted";
             $redirect = "file_manager.php?p=" . urlencode($current_folder);
         }
     } else {
         $alert_info = "You cannot delete this directory\\nInvalid directory";
     }
 }
 if ($_POST['create_folder'] == "Create folder") {
     if (@mkdir($current_folder . $_POST['folder_name'])) {
         $alert_info = "Folder created successfully!";
     } else {
         $alert_info = "Invalid folder name!";
     }
开发者ID:LFCavalcanti,项目名称:pfsense-packages,代码行数:31,代码来源:file_manager.php


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