本文整理汇总了PHP中FileManager::delete_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::delete_dir方法的具体用法?PHP FileManager::delete_dir怎么用?PHP FileManager::delete_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::delete_dir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_dir
public static function delete_dir($path = '', $encode = true)
{
$done = false;
if ($path == '') {
return true;
}
if (($dp = opendir($path)) !== false) {
while (($el = readdir($dp)) !== false) {
if ($el == '.' || $el == '..') {
continue;
}
$obj = $path . DS . $el;
if (is_file($obj)) {
FileManager::delete_file($obj);
continue;
}
if (is_dir($obj)) {
FileManager::delete_dir($obj);
}
}
closedir($dp);
rmdir($path);
$done = true;
}
return $done;
}
示例2: run
function run($location)
{
if (isset($_POST['userdir']) && strlen($_POST['userdir']) > 0) {
if ($location->uploadAllowed() && GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isNewdirAllowed()) {
$this->newFolder($location, $_POST['userdir']);
}
}
if (isset($_FILES['userfile']['name']) && strlen($_FILES['userfile']['name']) > 0) {
if ($location->uploadAllowed() && GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isUploadAllowed()) {
$this->uploadFile($location, $_FILES['userfile']);
}
}
if (isset($_GET['del'])) {
if (GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isDeleteAllowed()) {
$split_path = Location::splitPath($_GET['del']);
$path = "";
for ($i = 0; $i < count($split_path); $i++) {
$path .= $split_path[$i];
if ($i + 1 < count($split_path)) {
$path .= "/";
}
}
if ($path == "" || $path == "/" || $path == "\\" || $path == ".") {
return;
}
if (is_dir($path)) {
FileManager::delete_dir($path);
} else {
if (is_file($path)) {
FileManager::delete_file($path);
}
}
}
}
}
示例3: defined
<?php
/**
* Cyber Image Manager
*
*
* @package Cyber Image Manager
* @author Radik
* @copyright Copyright (c) 2010, Cyber Applications.
* @link http://www.cyberapp.ru/
* @since Version 1.1
* @file /includes/tasks/del_dir.php
*/
/*
Защита от прямой загрузки
*/
defined('ACCESS') or die;
echo json_encode(array('done' => FileManager::delete_dir(FileManager::convertToFileSystem(FileManager::clear_path(Manager::$conf['filesystem.files_abs_path'] . DS . $_REQUEST['path'])))));