Home > Article > Backend Development > Determine whether the directory is empty
//Determine whether the directory is empty, true is empty, false is not empty
function is_empty_dir($fp)
{
$H = @ opendir($fp);
$i=0;
while ($_file=readdir($H)){
$i++;
}
closedir($H);
if($i>2){
return false;
}else{
return true;
}
}