This commit is contained in:
2021-08-30 17:10:58 +08:00
parent 92d3c32172
commit 15185405fb
+4 -3
View File
@@ -393,13 +393,14 @@ class Router extends HttpService implements RouterInterface
* @param $method * @param $method
* @return Node|null * @return Node|null
* 查找指定路由 * 查找指定路由
* @throws Exception
*/ */
public function tree_search(?array $explode, $method): ?Node public function tree_search(?array $explode): ?Node
{ {
if (!isset($this->nodes[$method])) { if (!isset($this->nodes['/'])) {
return null; return null;
} }
$parent = $this->nodes[$method]['/']; $parent = $this->nodes['/'];
while ($value = array_shift($explode)) { while ($value = array_shift($explode)) {
$node = $parent->findNode($value); $node = $parent->findNode($value);
if (!$node) { if (!$node) {