改名
This commit is contained in:
@@ -487,6 +487,7 @@ class Router extends Application implements RouterInterface
|
|||||||
* @param $exception
|
* @param $exception
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function exception($exception): mixed
|
private function exception($exception): mixed
|
||||||
{
|
{
|
||||||
@@ -498,15 +499,22 @@ class Router extends Application implements RouterInterface
|
|||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Node|null 树干搜索
|
* @return Node|null 树干搜索
|
||||||
* 树干搜索
|
* 树干搜索
|
||||||
|
* @throws ConfigException
|
||||||
*/
|
*/
|
||||||
private function find_path(Request $request): ?Node
|
private function find_path(Request $request): ?Node
|
||||||
{
|
{
|
||||||
$method = $request->getMethod();
|
$method = $request->getMethod();
|
||||||
|
$uri = $request->headers->get('request_uri', '/');
|
||||||
|
|
||||||
|
$context = Config::get('router', false, ROUTER_HASH);
|
||||||
|
if ($context === ROUTER_TREE) {
|
||||||
|
return $this->Branch_search($request);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($this->nodes[$method])) {
|
if (!isset($this->nodes[$method])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$methods = $this->nodes[$method];
|
$methods = $this->nodes[$method];
|
||||||
$uri = $request->headers->get('request_uri', '/');
|
|
||||||
if (isset($methods[$uri])) {
|
if (isset($methods[$uri])) {
|
||||||
return $methods[$uri];
|
return $methods[$uri];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user