function recursiveRemoveDirectory($directory)
{
foreach(glob("{$directory}/*") as $file)
{
if(is_dir($file)) {
$this->recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
rmdir($directory);
}
Example : How to use above function.
$directory = 'www/abc';
recursiveRemoveDirectory($directory)
{
foreach(glob("{$directory}/*") as $file)
{
if(is_dir($file)) {
$this->recursiveRemoveDirectory($file);
} else {
unlink($file);
}
}
rmdir($directory);
}
Example : How to use above function.
$directory = 'www/abc';
recursiveRemoveDirectory($directory)
No comments:
Post a Comment