From 3a8eea91ab14989ecce36bb863612be85f9095ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 13 Oct 2020 12:11:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Route/Router.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index 95a3e336..9c2bd51a 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -18,6 +18,9 @@ use Snowflake\Exception\ConfigException; use Snowflake\Snowflake; use Swoole\Coroutine; +defined('ROUTER_TREE') or define('ROUTER_TREE', 1); +defined('ROUTER_HASH') or define('ROUTER_HASH', 2); + /** * Class Router * @package Snowflake\Snowflake\Route @@ -68,7 +71,7 @@ class Router extends Application implements RouterInterface if (!isset($this->nodes[$method])) { $this->nodes[$method] = []; } - if ($this->useTree) { + if (Config::get('router') == ROUTER_TREE) { return $this->tree($path, $handler, $method); } else { return $this->hash($path, $handler, $method);