纵有疾风起
人生不言弃

如何用php创建与删除多级目录函数 – php函数

如何用php创建与删除多级目录函数

  1.  
  2. function deldir($dir)  
  3. {  
  4.    $dh=opendir($dir);  
  5.    while ($file=readdir($dh))  
  6.    {  
  7.   if($file!=“.” && $file!=“..”)  
  8.   {  
  9. $fullpath=$dir.“/”.$file;  
  10. if(!is_dir($fullpath))  
  11. {  
  12. unlink($fullpath);  
  13. }  
  14. else 
  15. {  
  16. $this -> deldir($fullpath);  
  17. }  
  18.   }  
  19.    }  
  20.    closedir($dh);  
  21.    if(rmdir($dir))  
  22.    {  
  23. return true;  
  24.    }  
  25.    else 
  26.    {  
  27. return false;  
  28.    }  
  29. }  
  30.  
  31. function createFolder($path)  
  32. {  
  33.    if (!file_exists($path)){  
  34.    createFolder(dirname($path));  
  35.    mkdir($path, 0777);  
  36. }  

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

未经允许不得转载:起风网 » 如何用php创建与删除多级目录函数 – php函数
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录