Home >Backend Development >PHP Tutorial >Is there still a problem with deleting the directory and the files under it? I'll give you a written function_PHP Tutorial

Is there still a problem with deleting the directory and the files under it? I'll give you a written function_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 16:54:22795browse

    /**
* c_function::dir_delete()
* Delete directory
* @param $file directory name (without /)
* @return
*/
     function dir_delete($file)
     {
        if(file_exists($file))
        {
       if(is_dir($file))
       {
           $handle =opendir($file);
           while(false!==($filename=readdir($handle)))
           {
          if($filename!="."&&$filename!="..")$this->dir_delete($file."/".$filename);
           }
           closedir($handle);
           rmdir($file);
           return true;
       }
       else
       {
           unlink($file);
       }
        }
    }
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/631790.htmlTechArticle?php /*** c_function::dir_delete() * Delete directory * @param $file directory name (without /) * @return*/ function dir_delete($file) { if(file_exists($file)) { if(is_dir($file)) { $handle =...
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