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