framework/helpers/BaseUrl.php
public static function base($scheme = false)
    {
        $url = static::getUrlManager()->getBaseUrl();
        if ($scheme !== false) {
            $url = static::getUrlManager()->getHostInfo() . $url;
            $url = static::ensureScheme($url, $scheme);
        }

        return $url;
    }
public static function base($scheme = false)
    {
        $url = static::getUrlManager()->getBaseUrl();
        if ($scheme !== false) {
            $url = static::getUrlManager()->getHostInfo() . $url;
            $url = static::ensureScheme($url, $scheme);
        }

        return $url;
    }
Returns the base URL of the current request.
@param bool|string $scheme the URI scheme to use in the returned base URL:

- `false` (default): returning the base URL without host info.
- `true`: returning an absolute base URL whose scheme is the same as that in [[\yii\web\UrlManager::$hostInfo]].
- string: returning an absolute base URL with the specified scheme (either `http`, `https` or empty string
for protocol-relative URL).
@return string