src/Leevel/Router/Url.php
protected function withSuffix(string $url, $suffix): string
    {
        if ('/' === $url || 0 === strpos($url, '/?')) {
            return $url;
        }

        $suffix = true === $suffix ? $this->option['suffix'] : $suffix;

        if (false !== strpos($url, '?')) {
            $url = str_replace('?', $suffix.'?', $url);
        } else {
            $url .= $suffix;
        }

        return $url;
    }
protected function withSuffix(string $url, $suffix): string
    {
        if ('/' === $url || 0 === strpos($url, '/?')) {
            return $url;
        }

        $suffix = true === $suffix ? $this->option['suffix'] : $suffix;

        if (false !== strpos($url, '?')) {
            $url = str_replace('?', $suffix.'?', $url);
        } else {
            $url .= $suffix;
        }

        return $url;
    }
url 带后缀

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

@return string