當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。