Skip to content

Instantly share code, notes, and snippets.

@soiqualang
Last active August 24, 2017 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soiqualang/5ef5790e67b7ffa06ae6a3231cdc9297 to your computer and use it in GitHub Desktop.
Save soiqualang/5ef5790e67b7ffa06ae6a3231cdc9297 to your computer and use it in GitHub Desktop.
delete all function
//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