This commit is contained in:
2021-08-05 11:34:10 +08:00
parent dae8e52d07
commit 3375db806e
+3 -1
View File
@@ -7,6 +7,7 @@ use Closure;
use Exception;
use HttpServer\Abstracts\HttpService;
use HttpServer\Controller;
use HttpServer\Exception\RequestException;
use HttpServer\Http\Request;
use HttpServer\Http\Response;
use HttpServer\IInterface\Middleware;
@@ -416,6 +417,7 @@ class Router extends HttpService implements RouterInterface
* @param $method
* @return Node|null
* 查找指定路由
* @throws RequestException
*/
public function tree_search(?array $explode, $method): ?Node
{
@@ -427,7 +429,7 @@ class Router extends HttpService implements RouterInterface
while ($value = array_shift($explode)) {
$node = $parent->findNode($value);
if (!$node) {
break;
throw new RequestException('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', 404);
}
$parent = $node;
}