add get ip&schema function

This commit is contained in:
xiaomlove
2022-04-07 00:54:05 +08:00
parent f2b9268a1f
commit e093b91133
8 changed files with 45 additions and 14 deletions

View File

@@ -443,15 +443,10 @@ function arr_set(&$array, $key, $value)
return $array;
}
function isHttps()
function isHttps(): bool
{
if (RUNNING_IN_OCTANE) {
$https = request()->server('HTTPS');
$result = !empty($https) && (strtolower($https) !== 'off');
} else {
$result = !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) !== 'off');
}
return $result;
$schema = nexus()->getRequestSchema();
return $schema == 'https';
}