选择语言 :

 Bootstrap::protocol

返回协议类型

当在命令行里执行,则返回null

string Bootstrap::protocol( )
返回值
  • string `null` | `http://` | `https://`
File: ./core/bootstrap.php
public static function protocol()
{
    static $protocol = null;

    if (null===$protocol)
    {
        if (IS_CLI)
        {
            return null;
        }
        else
        {
            $https_key = self::$core_config['server_https_on_key'];
            if ($https_key)
            {
                $https_key = strtoupper($https_key);
            }
            else
            {
                $https_key = 'HTTPS';
            }
            if ( !empty($_SERVER[$https_key]) && filter_var($_SERVER[$https_key], FILTER_VALIDATE_BOOLEAN) )
            {

                $protocol = 'https://';
            }
            else
            {
                $protocol = 'http://';
            }
        }
    }

    return $protocol;
}