This commit is contained in:
2021-08-05 11:23:31 +08:00
parent 78d1d4f279
commit 9162b02766
+2 -8
View File
@@ -419,16 +419,10 @@ class Router extends HttpService implements RouterInterface
*/ */
public function tree_search(?array $explode, $method): ?Node public function tree_search(?array $explode, $method): ?Node
{ {
if (empty($explode)) { if (!isset(static::$nodes[$method])) {
return static::$nodes[$method]['/'] ?? null;
}
$first = array_shift($explode);
if (!($parent = static::$nodes[$method][$first] ?? null)) {
return null; return null;
} }
if (empty($explode)) { $parent = static::$nodes[$method]['/'];
return $parent->findNode('/');
}
while ($value = array_shift($explode)) { while ($value = array_shift($explode)) {
$node = $parent->findNode($value); $node = $parent->findNode($value);
if (!$node) { if (!$node) {