Home > Backend Development > PHP Tutorial > php delete directory and all files_PHP tutorial

php delete directory and all files_PHP tutorial

WBOY
Release: 2016-07-13 10:58:27
Original
842 people have browsed it

function del($name) {
  if (!is_dir($name)) {
   return @unlink($name);
  } else {
   $dir = opendir($name);
   while( $file = readdir( $dir ) ) {
    if (($file=='.')||($file=='..')) continue;
    if (is_dir($name.'/'.$file)) $this->del($name.'/'.$file);
    else echo basename($file), @unlink($name.'/'.$file) ? ' Success!' : ' False.', '
';
   }
  closedir($dir);
  }
  return @rmdir($name);
 }

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632003.htmlTechArticlefunction del($name) { if (!is_dir($name)) { return @unlink($name); } else { $dir = opendir($name); while( $file = readdir( $dir ) ) { if (($file=='.')||($file=='..')) continue; if...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template