11 删除文件夹内容

function Delete($path)
{
  if (is_dir($path) === true) {
    $files = array_diff(scandir($path), array('.', '..'));
    foreach ($files as $file) {
      Delete(realpath($path) . '/' . $file);
    }
    return rmdir($path);
  } else if (is_file($path) === true) {
    return unlink($path);
  }
  return false;
}

  

posted on 2017-06-06 17:29  泪滴  阅读(98)  评论(0编辑  收藏  举报