本文整理汇总了PHP中Files::delFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::delFolder方法的具体用法?PHP Files::delFolder怎么用?PHP Files::delFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::delFolder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _delDir
/**
* Delete directories recursively.
* @param string $relative the relative path to be deleted.
* @return boolean true if deleted, false otherwise.
*/
function _delDir($relative)
{
$fullpath = Files::makePath($this->getImagesDir(), $relative);
if ($this->countFiles($fullpath) <= 0) {
return Files::delFolder($fullpath, true);
} else {
return false;
}
}
示例2: delFolder
/**
* Delete folder(s), can delete recursively.
* @param string $folder the folder to be deleted.
* @param boolean $recursive if true, all files and sub-directories
* are delete. If false, tries to delete the folder, can throw
* error if the directory is not empty.
* @return boolean true if deleted.
*/
function delFolder($folder, $recursive = false)
{
$deleted = true;
if ($recursive) {
$d = dir($folder);
while (false !== ($entry = $d->read())) {
if ($entry != '.' && $entry != '..') {
$obj = Files::fixPath($folder) . $entry;
//var_dump($obj);
if (is_file($obj)) {
$deleted &= Files::delFile($obj);
} else {
if (is_dir($obj)) {
$deleted &= Files::delFolder($obj, $recursive);
}
}
}
}
$d->close();
}
//$folder= $folder.'/thumbs';
//var_dump($folder);
if (is_dir($folder)) {
$deleted &= rmdir($folder);
} else {
$deleted &= false;
}
return $deleted;
}
示例3: _delDir
/**
* Delete directories recursively.
* @param string $relative the relative path to be deleted.
* @return boolean true if deleted, false otherwise.
*/
function _delDir($relative)
{
$fullpath = Files::makePath($this->getImagesDir(), $relative);
// if($this->countFiles($fullpath) <= 0)
return Files::delFolder($fullpath, true);
//delete recursively.
//else
//Return false;
}
示例4: _delDir
/**
* Delete directories recursively.
* @param string $relative the relative path to be deleted.
* @return boolean true if deleted, false otherwise.
*/
function _delDir($relative)
{
if (!$this->validRelativePath($relative)) {
return false;
}
$fullpath = Files::makePath($this->getBaseDir(), $relative);
if ($this->countFiles($fullpath) <= 0) {
return Files::delFolder($fullpath, true);
} else {
return false;
}
}
示例5: _delDir
/**
* Delete directories recursively.
* @param string $relative the relative path to be deleted.
* @return boolean true if deleted, false otherwise.
*/
function _delDir($relative)
{
$fullpath = Files::makePath($this->getBaseDir(), $relative);
//we can delete recursively even if there are images in the dir
//if($this->countFiles($fullpath) <= 0) {
// now we use the default delete_document function
//return Files::delFolder($fullpath,true); //delete recursively.
global $_course;
if (isset($_course) && !empty($_course) && isset($_course['code'])) {
$path_dir = substr($fullpath, strpos($fullpath, '/document/') + 9, -1);
//
$base_dir = substr($fullpath, 0, strlen($fullpath) - strlen($path_dir));
//
return DocumentManager::delete_document($_course, $path_dir, $base_dir);
} else {
if ($this->countFiles($fullpath) <= 0) {
return Files::delFolder($fullpath, true);
} else {
return false;
}
}
}