src/Controller.php
static function addGlobal(array $controllers) {
        if (!is_array($controllers[0]))
            $controllers = [$controllers];
        foreach ($controllers as $controller) {
            [$name, $controller, $method] = $controller;
            if (isset(self::$globals[$name]))
                Console::warning("Overwriting global controller \"$name\".");
            $controller = Server::$name.'\\Controller\\'.$controller;
            if (!class_exists($controller) || !is_subclass_of($controller, Controller::class)) {
                Console::warning("Invalid controller \"$controller\".");
                return;
            }
            if (!method_exists($controller, $method)) {
                Console::warning("Invalid method \"$method\".");
                return;
            }
            self::$globals[$name] = [$controller, $method];
        }
    }
static function addGlobal(array $controllers) {
        if (!is_array($controllers[0]))
            $controllers = [$controllers];
        foreach ($controllers as $controller) {
            [$name, $controller, $method] = $controller;
            if (isset(self::$globals[$name]))
                Console::warning("Overwriting global controller \"$name\".");
            $controller = Server::$name.'\\Controller\\'.$controller;
            if (!class_exists($controller) || !is_subclass_of($controller, Controller::class)) {
                Console::warning("Invalid controller \"$controller\".");
                return;
            }
            if (!method_exists($controller, $method)) {
                Console::warning("Invalid method \"$method\".");
                return;
            }
            self::$globals[$name] = [$controller, $method];
        }
    }
添加全局控制器绑定

@param array $controllers