改名
This commit is contained in:
@@ -7,6 +7,7 @@ use Closure;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use HttpServer\Abstracts\HttpService;
|
use HttpServer\Abstracts\HttpService;
|
||||||
use HttpServer\Controller;
|
use HttpServer\Controller;
|
||||||
|
use HttpServer\Exception\RequestException;
|
||||||
use HttpServer\Http\Request;
|
use HttpServer\Http\Request;
|
||||||
use HttpServer\Http\Response;
|
use HttpServer\Http\Response;
|
||||||
use HttpServer\IInterface\Middleware;
|
use HttpServer\IInterface\Middleware;
|
||||||
@@ -416,6 +417,7 @@ class Router extends HttpService implements RouterInterface
|
|||||||
* @param $method
|
* @param $method
|
||||||
* @return Node|null
|
* @return Node|null
|
||||||
* 查找指定路由
|
* 查找指定路由
|
||||||
|
* @throws RequestException
|
||||||
*/
|
*/
|
||||||
public function tree_search(?array $explode, $method): ?Node
|
public function tree_search(?array $explode, $method): ?Node
|
||||||
{
|
{
|
||||||
@@ -427,7 +429,7 @@ class Router extends HttpService implements RouterInterface
|
|||||||
while ($value = array_shift($explode)) {
|
while ($value = array_shift($explode)) {
|
||||||
$node = $parent->findNode($value);
|
$node = $parent->findNode($value);
|
||||||
if (!$node) {
|
if (!$node) {
|
||||||
break;
|
throw new RequestException('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', 404);
|
||||||
}
|
}
|
||||||
$parent = $node;
|
$parent = $node;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user