Last active
August 24, 2017 07:15
-
-
Save soiqualang/5ef5790e67b7ffa06ae6a3231cdc9297 to your computer and use it in GitHub Desktop.
delete all function
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
//ham xoa tat tan tat | |
function delete_files($target) { | |
if(is_dir($target)){ | |
$files = glob( $target . '*', GLOB_MARK ); //GLOB_MARK adds a slash to directories returned | |
foreach( $files as $file ) | |
{ | |
delete_files( $file ); | |
} | |
rmdir( $target ); | |
} elseif(is_file($target)) { | |
unlink( $target ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment