Home  >  Article  >  php教程  >  php删除目录的函数

php删除目录的函数

WBOY
WBOYOriginal
2016-06-13 11:16:551061browse

php删除目录的函数  

实例应用做删除有文件目录的函数:
function scmulu($mlming)
{
 $dkml = opendir($mlming);
 readdir($dkml);
 readdir($dkml);
 while(($wj = readdir($dkml))!==false)
 {
  $wj = $mlming.DIRECTORY_SEPARATOR.$wj;
  if(is_dir($wj))
  {
   scmulu($wj);
  }else
  {
   if(unlink($wj))
   {
    echo "文件$wj删除成功
";
   }else
   {
    echo "文件$wj删除失败
";
   }
  }
 }
 closedir($dkml);
  if(rmdir($mlming))
  {
   echo "目录$mlming删除成功
";
  }else
  {
   echo "目录$mlming删除失败
";
  }
}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn