-
-
Save wenpeng/040b10fb3e0f599b29ed5cc1b62b5805 to your computer and use it in GitHub Desktop.
Php Delete folder
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
function Delete($path) | |
{ | |
if (is_dir($path) === true) | |
{ | |
$files = array_diff(scandir($path), array('.', '..')); | |
foreach ($files as $file) | |
{ | |
Delete(realpath($path) . '/' . $file); | |
} | |
return rmdir($path); | |
} | |
else if (is_file($path) === true) | |
{ | |
return unlink($path); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment