本文整理匯總了PHP中General::rmdirr方法的典型用法代碼示例。如果您正苦於以下問題:PHP General::rmdirr方法的具體用法?PHP General::rmdirr怎麽用?PHP General::rmdirr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類General
的用法示例。
在下文中一共展示了General::rmdirr方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: delete
public static function delete($path, $cascade = false)
{
$view = self::loadFromPath($path);
if ($cascade == false) {
foreach ($view->children() as $child) {
$bits = preg_split('~\\/~', $child->path, -1, PREG_SPLIT_NO_EMPTY);
unset($bits[count($bits) - 2]);
View::move($child, trim(implode('/', $bits), '/'));
}
}
General::rmdirr(VIEWS . '/' . trim($path, '/'));
}
示例2: uninstall
function uninstall()
{
$errors = $notices = array();
## REMOVE CAMPFIRE FOLDER
General::rmdirr(DOCROOT . '/campfire', $errors, $notices);
## REMOVE WORKSPACE FOLDER
General::rmdirr(DOCROOT . '/workspace', $errors, $notices);
## REMOVE MANIFEST FOLDER
General::rmdirr(DOCROOT . '/manifest', $errors, $notices);
@unlink(DOCROOT . '/.htaccess');
return;
}
示例3: rmdirr
function rmdirr($target, &$errors, &$notices)
{
$errors = $notices = array();
$exceptions = array('.', '..');
if (!($sourcedir = @opendir($target))) {
$errors[] = 'Could not open ' . $target;
return false;
}
while (false !== ($sibling = readdir($sourcedir))) {
if (!in_array($sibling, $exceptions)) {
$object = str_replace('//', '/', $target . '/' . $sibling);
$notices[] = 'Processing: ' . $object;
if (@is_dir($object)) {
General::rmdirr($object, $errors, $notices);
}
if (@is_file($object)) {
if ($result = @unlink($object)) {
$notices[] = $object . ' has been removed.';
} else {
$errors[] = 'Could not remove file - ' . $object;
}
}
}
}
closedir($sourcedir);
if ($result = @rmdir($target)) {
$notices[] = $target . ' has been removed.';
return true;
}
$errors[] = $target . ' could not be removed.';
return false;
}