日期:2013-05-09  浏览次数:20492 次

 // ========== doDelDir函数 START ==========
        function doDelDir($dir)
        {
            $dh=opendir($dir);
            while ($file=readdir($dh))
            {
                if($file!="." && $file!="..")
                {
                    $fullpath=$dir."/".$file;
                    if(!is_dir($fullpath))
                    {
                        unlink($fullpath);
                    }
                    else
                    {
                        $this->doDelDir($fullpath);
                    }
                }
            }
            closedir($dh);
            if (rmdir($dir))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
  // ========== doDelDir函数 END ==========

  // ========== doMoveDir函数 START ==========
  function doMoveDir($source,$target)
  {
   if(is_dir($source))
   {
    $dest_name=basename($source);
    if(!mkdir($target.$dest_name))
    {
     return false;
    }
    $d=dir($source);
    while(($entry=$d->read())!==false)
    {
     if(is_dir($source.$entry))
     {
      if($entry=="."||$entry=="..")
      {
       continue;
      }
      else
      {
       $this->doMoveDir("$source$entry\\","$target$dest_name\\");
&