From 56a94564ab5705d6a11916df6b62f9fa665b7b66 Mon Sep 17 00:00:00 2001 From: xl Date: Mon, 12 Jun 2023 17:58:07 +0800 Subject: [PATCH] qqq --- src/RouterCollector.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/RouterCollector.php b/src/RouterCollector.php index e3ce2fb..95800f9 100644 --- a/src/RouterCollector.php +++ b/src/RouterCollector.php @@ -154,7 +154,9 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate public function register(string $path, string $method, Handler $handler): void { $hashMap = HashMap::Tree($this->methods, $method); - foreach (str_split($path, 4) as $item) { + + $lists = explode('/', $path); + foreach ($lists as $item) { if ($hashMap->has($item)) { $hashMap = $hashMap->get($item); } else { @@ -220,7 +222,7 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate $path = '/*'; } - $lists = str_split($path, 4); + $lists = explode('/', $path); foreach ($lists as $item) { $parent = $parent->get($item); if ($parent === null) {