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