路由

php 路由实现类,基于fastroute

<?php

/**
 * 核心路由查找器
 */

use FastRoute\RouteCollector;
use function FastRoute\simpleDispatcher;
use function FastRoute\cachedDispatcher;

class FastRoute {

 public function __construct()
 {
     
/** @var object $dispatcher 导入配置中的路由规则 */
// $dispatcher = simpleDispatcher(function (RouteCollector $r) {
    $dispatcher = cachedDispatcher(function (RouteCollector $r) {
        foreach