Delete the directory and all files in the directory * del_dir (delete path, 1 means deleting the data in the directory, 0 defaults to deleting this directory);
Delete the directory and all files in the directory
* del_dir (delete path, 1 means deleting data in the directory, 0 defaults to deleting this directory);
*/
function del_dir($dir_adds='',$del_def=0) {
$result = false;
If(! is_dir($dir_adds)){
return false;
}
$handle = opendir($dir_adds);
While(($file = readdir($handle)) !== false){
If($file != '.' && $file != '..') {
$dir = $dir_adds . directory_separator . $file;
is_dir($dir) ? $this->del_dir($dir) : unlink($dir);
}
}
closedir($handle);
If($del_def==0){
$result = rmdir($dir_adds) ? true : false;
}else {
$result = true;
}
Return $result;
}