Last active
March 4, 2022 08:43
-
-
Save kazumich/c12d1ecf87acfe1b6e5f to your computer and use it in GitHub Desktop.
掃除用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// -------------------------- | |
// | |
// 掃除用 | |
// | |
// -------------------------- | |
$deletePath = realpath('.'); | |
rrmdir($deletePath,$deletePath); | |
echo $deletePath. " delete !"; | |
// -------------------------- | |
// ディレクトリを削除する function | |
// -------------------------- | |
function rrmdir($dir,$start) { | |
if (is_dir($dir)) { | |
$objects = scandir($dir); | |
foreach ($objects as $object) { | |
if ($object != "." && $object != "..") { | |
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object,$start); else unlink($dir."/".$object); | |
} | |
} | |
reset($objects); | |
if ($start != $dir) rmdir($dir); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment