function delDirAndFile($path, $delDir = FALSE)
{
if (is_array($path)) {
foreach ($path as $subPath)
delDirAndFile($subPath, $delDir);
}
if (is_dir($path)) {
$handle = opendir($path);
if ($handle) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..")
is_dir("$path/$item") ? delDirAndFile("$path/$item", $delDir) : unlink("$path/$item");
}
closedir($handle);
if ($delDir)
return rmdir($path);
}
} else {
if (file_exists($path)) {
return unlink($path);
} else {
return FALSE;
}
}
clearstatcache();
}

相关文章:

  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-11-21
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-12-01
相关资源
相似解决方案