yejinmo
2017-09-22 09:15:21 +08:00
public function getFolder($dir, $num)
{
$targetDir = rtrim($dir, '/');
if (!is_dir($targetDir))
return false;
$result = false;
$folders = scandir($targetDir);
foreach ( $folders as $folder)
{
if($folder == '.' || $folder == '..' || $folder == '__MACOSX' || $folder == '.DS_Store')
{
continue;
}
$subDir = $targetDir . DIRECTORY_SEPARATOR . $folder;
if (!is_dir($subDir))
continue;
if ($folder == $num)
{
$result = $targetDir . DIRECTORY_SEPARATOR . $folder;
return $result;
}
else
{
return $this->getFolder($subDir, $num);
}
}
}