Home  >  Article  >  Backend Development  >  PHP中判断索引是否为空的函数

PHP中判断索引是否为空的函数

WBOY
WBOYOriginal
2016-06-13 13:17:40855browse

PHP中判断目录是否为空的函数

判断目录是否为空,true为空,false为不空

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;  
	}
}
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