This article mainly introduces how to delete directory custom functions in PHP. It has certain reference value. Now I share it with you. Friends in need can refer to it.
function rm_dir($dir) { if($handle = opendir($dir)) { while (false !== ($item = readdir($handle))) { if($item != "." && $item != "..") { if(is_dir("$dir/$item")) { rm_dir("$dir/$item"); } else { unlink("$dir/$item"); echo "removing $dir/$item "; } } } closedir($handle); rmdir($dir); echo "removing$dir "; } }
The above is the entire content of this article. , I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
Introduction to PHP’s random probability calculation function
The above is the detailed content of How to delete directory custom functions in PHP. For more information, please follow other related articles on the PHP Chinese website!