返回协议类型
当在命令行里执行,则返回null
string Bootstrap::protocol( )
string
`null` | `http://` | `https://`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;
}