本文整理汇总了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;
}
}
示例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;
}
}
示例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!";
}