|
|
@ -200,14 +200,16 @@ Class DirScanner { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//根据路径和根目录获取当前扫描的目录深度 |
|
|
|
//根据路径和根目录获取当前扫描的目录深度 |
|
|
|
private function getScanningLevel($rootDir, $dirname) { |
|
|
|
private function getScanningLevel($rootDir, $dir) { |
|
|
|
$level = 0; |
|
|
|
$level = 0; |
|
|
|
|
|
|
|
|
|
|
|
if ($dirname == $rootDir) { |
|
|
|
$rootDir = realpath($rootDir); |
|
|
|
|
|
|
|
$dir = realpath($dir); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($dir == $rootDir) { |
|
|
|
$level = 1; |
|
|
|
$level = 1; |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
$dirname = preg_replace('/\/$/', '', $dirname); |
|
|
|
$dirs = explode('/', str_replace($rootDir, '', $dir)); |
|
|
|
$dirs = explode('/', str_replace($rootDir, '', $dirname)); |
|
|
|
|
|
|
|
$level = count($dirs); |
|
|
|
$level = count($dirs); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -467,7 +469,7 @@ Class DirScanner { |
|
|
|
if (empty($this->rootDir)) { |
|
|
|
if (empty($this->rootDir)) { |
|
|
|
$this->rootDir = realpath($dir); |
|
|
|
$this->rootDir = realpath($dir); |
|
|
|
} |
|
|
|
} |
|
|
|
$this->scanningDirLevel = $this->getScanningLevel($this->rootDir, realpath($dir)); |
|
|
|
$this->scanningDirLevel = $this->getScanningLevel($this->rootDir, $dir); |
|
|
|
$nextLevels = $levels - $this->scanningDirLevel; |
|
|
|
$nextLevels = $levels - $this->scanningDirLevel; |
|
|
|
|
|
|
|
|
|
|
|
$files = scandir($dir); |
|
|
|
$files = scandir($dir); |
|
|
|