Created
July 12, 2017 16:56
-
-
Save jairoFernandez/fd157cbff6e611f713318a525187b5d8 to your computer and use it in GitHub Desktop.
Delete a folder with PHP
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
public function removeDirectory($path) { | |
if(is_dir($path)){ | |
$files = glob($path . '/*'); | |
foreach ($files as $file) { | |
is_dir($file) ? $this->removeDirectory($file) : unlink($file); | |
} | |
rmdir($path); | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment