Cml\Service\FastRoute::parseUrl PHP Method

parseUrl() public method

解析url
public parseUrl ( ) : mixed
return mixed
    public function parseUrl()
    {
        $dispatcher = \FastRoute\simpleDispatcher(function (RouteCollector $r) {
            foreach ($this->routes as $route) {
                $r->addRoute($route['method'], $route['uri'], $route['action']);
            }
        });
        \Cml\Route::parsePathInfo();
        $httpMethod = isset($_POST['_method']) ? strtoupper($_POST['_method']) : strtoupper($_SERVER['REQUEST_METHOD']);
        $routeInfo = $dispatcher->dispatch($httpMethod, implode('/', \Cml\Route::getPathInfo()));
        switch ($routeInfo[0]) {
            case Dispatcher::NOT_FOUND:
            case Dispatcher::METHOD_NOT_ALLOWED:
                break;
            case Dispatcher::FOUND:
                $_GET += $routeInfo[2];
                if (is_callable($routeInfo[1])) {
                    call_user_func($routeInfo[1]);
                    Cml::cmlStop();
                }
                $this->parseUrlParams($routeInfo[1]);
                break;
        }
        return $dispatcher;
    }