php教程获取目录下すべて文件实现代码
class a{
private $img_dir;
private $img_path;
private $face_files = array();
private $allow_extension = array();プライベート関数 get_face_files()
{
$files = array();
if(is_dir($this->img_dir))
{
if ($dh = opendir($this->) ;img_dir))
{
while (($file = readdir($dh)) !== false)
{
if($file == '.') continue;
if($file == '..') continue;
$fileinfo =explode('.', (basename($file)));
if(in_array($fileinfo[1], $this->allow_extension))
{
$files[] = array(
'ファイル名' => $fileinfo[0] ,
$fileinfo[1],
);
}
}
closeir($dh);
}
}
}
}