手机
当前位置:查字典教程网 >编程开发 >php教程 >php中通过DirectoryIterator删除整个目录的方法
php中通过DirectoryIterator删除整个目录的方法
摘要:本文实例讲述了php中通过DirectoryIterator删除整个目录的方法。分享给大家供大家参考。具体实现方法如下:isDir()){i...

本文实例讲述了php中通过DirectoryIterator删除整个目录的方法。分享给大家供大家参考。具体实现方法如下:

<?php function cleanup_directory($dir) { foreach (new DirectoryIterator($dir) as $file) { if ($file->isDir()) { if (! $file->isDot()) { cleanup_directory($file->getPathname()); } } else { unlink($file->getPathname()); } } rmdir($dir); } ?>

希望本文所述对大家的php程序设计有所帮助。

【php中通过DirectoryIterator删除整个目录的方法】相关文章:

php递归调用删除数组空值元素的方法

php删除指定目录的方法

开发大型PHP项目的方法

php对象和数组相互转换的方法

php猴子选大王问题解决方法

php计算整个目录大小的方法

php循环table实现一行两列显示的方法

php转换颜色为其反色的方法

php采集中国代理服务器网的方法

php 类自动载入的方法

精品推荐
分类导航