src/Leevel/Router/Url.php
protected function makeUrl(string $url, array $params, $suffix): string
    {
        $this->params = $params;

        if ('/' !== substr($url, 0, 1)) {
            $url = '/'.$url;
        }

        if (false !== strpos($url, '{')) {
            $url = preg_replace_callback('/{(.+?)}/', function ($matches) {
                if (isset($this->params[$matches[1]])) {
                    $value = $this->params[$matches[1]];
                    unset($this->params[$matches[1]]);
                } else {
                    $value = $matches[0];
                }

                return $value;
            }, $url);
        }

        if ($this->params) {
            $queryUrl = http_build_query($this->params);
            $url .= (false !== strpos($url, '?') ? '&' : '?').$queryUrl;
        }

        $url = $this->withSuffix($url, $suffix);

        return $url;
    }
protected function makeUrl(string $url, array $params, $suffix): string
    {
        $this->params = $params;

        if ('/' !== substr($url, 0, 1)) {
            $url = '/'.$url;
        }

        if (false !== strpos($url, '{')) {
            $url = preg_replace_callback('/{(.+?)}/', function ($matches) {
                if (isset($this->params[$matches[1]])) {
                    $value = $this->params[$matches[1]];
                    unset($this->params[$matches[1]]);
                } else {
                    $value = $matches[0];
                }

                return $value;
            }, $url);
        }

        if ($this->params) {
            $queryUrl = http_build_query($this->params);
            $url .= (false !== strpos($url, '?') ? '&' : '?').$queryUrl;
        }

        $url = $this->withSuffix($url, $suffix);

        return $url;
    }
自定义 URL.

@param string      $url
@param array       $params
@param bool|string $suffix

@return string