php 遍历目录下的所有文件

426 阅读1分钟
function list_file($path='/Public/Api/img/swiper'){
	$arr=[];
	$temp=\scandir('.'.$path);
	foreach($temp as $v){
		$file=$path.'/'.$v;
		if($v=='.'||$v=='..'||\is_dir($file))continue;
		$arr[]='https://'.$_SERVER[HTTP_HOST].$file;
	}
	return $arr;
}