public static function scandir($dir)
{
$paths = array();
foreach (scandir($dir) as $item) {
if ($item != '.' && $item != '..') {
if (is_dir($path = realpath($dir . DIRECTORY_SEPARATOR . $item))) {
$paths = array_merge(self::scandir($path), $paths);
} else {
$paths[] = $path;
}
}
}
return $paths;
}