浏览代码

Core\Router: Fix for dynamic files in the forum root

Example: /sitemap.xml, /sitemap1.xml, /sitemap542.xml
Visman 1 年之前
父节点
当前提交
5ebf9eb3f6
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      app/Core/Router.php

+ 6 - 1
app/Core/Router.php

@@ -234,7 +234,12 @@ class Router
         }
 
         $pos  = \strpos($uri, '/', 1);
-        $base = false === $pos ? $uri : \substr($uri, 0, $pos);
+
+        if (false === $pos) {
+            $base = isset($this->dynamic[$uri]) ? $uri : '/';
+        } else {
+            $base = \substr($uri, 0, $pos);
+        }
 
         if (isset($this->dynamic[$base])) {
             foreach ($this->dynamic[$base] as $pattern => $data) {