From 4b4bd185f5c2bacdd2769e6db5daa3c148c1dabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 16 Apr 2023 16:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scanner.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Scanner.php b/Scanner.php index f57aa03..5dc2fd9 100644 --- a/Scanner.php +++ b/Scanner.php @@ -36,7 +36,7 @@ class Scanner extends Component { $container = Container::instance(); foreach ($this->files as $file) { - $class = $namespace . '\\' . $this->rename($file); + $class = $this->rename($file); if (file_exists($class)) { error('Please follow the PSR-4 specification to write code.' . $class); continue; @@ -58,7 +58,6 @@ class Scanner extends Component } return ucfirst($value); }); - array_shift($filter); return implode('\\', $filter); } @@ -76,7 +75,7 @@ class Scanner extends Component } if ($value->isDir()) { $this->load_dir($value->getRealPath()); - } else if ($value->getExtension() == '.php') { + } else if ($value->getExtension() == 'php') { $this->load_file($value); } } @@ -91,7 +90,7 @@ class Scanner extends Component { try { require_once "$path"; - $path = str_replace($_SERVER['HOME'], '', $path); + $path = str_replace($_SERVER['PWD'], '', $path); $path = str_replace('.php', '', $path); $this->files[] = $path; } catch (\Throwable $throwable) {