From 20a8b32cdfb72d255974003480a4534b5b6cc403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 11 Oct 2023 13:14:37 +0800 Subject: [PATCH] eee --- function.php | 59 +++------------------------------------------------- 1 file changed, 3 insertions(+), 56 deletions(-) diff --git a/function.php b/function.php index a11c3838..45b5e8b8 100644 --- a/function.php +++ b/function.php @@ -218,37 +218,6 @@ if (!function_exists('directory')) { } -if (!function_exists('isUrl')) { - - - /** - * @param $url - * @param bool $get_info - * @return false|array - */ - function isUrl($url, bool $get_info = TRUE): bool|array - { - if (str_starts_with($url, '/')) { - return FALSE; - } - $queryMatch = '/((http[s]?):\/\/)?(([\w\-\_]+\.)+\w+(:\d+)?)(\/.*)?/'; - if (!preg_match($queryMatch, $url, $outPut)) { - return FALSE; - } - - [$scheme, $host, $port, $user, $pass, $query, $path, $fragment] = parse_url($url); - if ($scheme == 'https' && empty($port)) { - $port = 443; - } - - if (!empty($query)) $path .= '?' . $query; - if (!empty($fragment)) $path .= '#' . $fragment; - - return [$scheme == 'https', $host, $port, $path]; - } - -} - if (!function_exists('msgpack_pack')) { @@ -285,7 +254,9 @@ if (!function_exists('request')) { */ function request(): RequestInterface { - return Kiri::getDi()->get(RequestInterface::class); + $request = Kiri::getDi()->get(RequestInterface::class); + + return Context::get(RequestInterface::class, $request); } } @@ -308,30 +279,6 @@ if (!function_exists('response')) { } -if (!function_exists('split_request_uri')) { - - - /** - * @param $url - * @return false|array - */ - function split_request_uri($url): bool|array - { - if (($parse = isUrl($url, NULL)) === FALSE) { - return FALSE; - } - - [$isHttps, $domain, $port, $path] = $parse; - $uri = $isHttps ? 'https://' . $domain : 'http://' . $domain; - if (!empty($port)) { - $uri .= ':' . $port; - } - return [$uri, $path]; - } - -} - - if (!function_exists('redis')) {