Files
kiri-core/ex/Router.php
T
2021-07-17 02:16:49 +08:00

34 lines
461 B
PHP

<?php
class Router
{
private static array $_routers = [];
/**
* @param string $path
* @param Closure|array|string $callback
*/
public static function get(string $path, Closure|array|string $callback)
{
static::$_routers[$path] = $callback;
}
/**
* @param $path
* @return mixed
*/
public static function findPath($path): mixed
{
if (!isset(static::$_routers[$path])) {
return null;
}
return static::$_routers[$path];
}
}