推荐:《php视频教程》
php删除文件夹和其下的内容
代码如下:
<?phpfunction deldir($dir) { //先删除目录下的文件: $dh=opendir($dir); while ($file=readdir($dh)) { if($file!="." && $file!="..") { $fullpath=$dir."/".$file; if(!is_dir($fullpath)) { unlink($fullpath); } else { deldir($fullpath);// 递归 } } } closedir($dh); // 删除空文件夹:递归 if(rmdir($dir)) { return true; } else { return false; }}
以上就是php如何删除文件夹内容的详细内容。
