From efd4dd1f5b06763c2419060d713f38f6a6207d67 Mon Sep 17 00:00:00 2001 From: chenlong Date: Mon, 27 May 2024 15:11:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3windos=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin/Service/ApiDocService.php | 4 ++++ Install.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Admin/Service/ApiDocService.php b/Admin/Service/ApiDocService.php index 70ca6ee..599bada 100644 --- a/Admin/Service/ApiDocService.php +++ b/Admin/Service/ApiDocService.php @@ -71,6 +71,9 @@ class ApiDocService $apiList = []; foreach ($paths as ['path' => $path, 'namespace' => $namespace, 'namespace_root' => $namespaceRoot, ]) { + $namespaceRoot = strtr(strtr($namespaceRoot, ['\\' => '/']), ['/' => DIRECTORY_SEPARATOR]); + $path = strtr(strtr($path, ['\\' => '/']), ['/' => DIRECTORY_SEPARATOR]); + $MPaths = $this->getPaths($path); foreach ($MPaths as $MPath) { @@ -82,6 +85,7 @@ class ApiDocService } $classFullName = implode("\\", [$namespace, ...explode(DIRECTORY_SEPARATOR, strtr(dirname($eachFile->filepath), [$namespaceRoot => ''])), $classname]); $classFullName = preg_replace('/\\\+/', '\\', $classFullName); + try { if (!class_exists($classFullName)) { return; diff --git a/Install.php b/Install.php index f135934..400edae 100644 --- a/Install.php +++ b/Install.php @@ -13,7 +13,7 @@ class Install implements PluginsInstallInterface echo "ApiDoc 安装成功。\n"; echo "示例代码查看 ApiDoc/Controller/DemoController.php。\n"; echo "示例效果查看文档访问地址。\n"; - echo "文档访问地址: {$_SERVER["SERVER_NAME"]}/admin/plugins/api-doc\n"; + echo "文档访问地址: http://127.0.0.1/admin/plugins/api-doc\n"; echo "===============================================================\n"; } } \ No newline at end of file