主域名截取优化

feat/task1-c-wallet
gongfuxiang 2025-03-14 10:26:52 +08:00
parent 4a0b962883
commit 6cc8c6610d
1 changed files with 6 additions and 0 deletions

View File

@ -76,6 +76,12 @@ if(empty($_SERVER['HTTP_HOST']) || is_numeric(str_replace('.', '', $_SERVER['HTT
$main_domain = $arr[$len-2].'.'.$arr[$len-1];
}
}
// 去掉端口
if(!empty($main_domain) && stripos($main_domain, ':') !== false)
{
$arr = explode(':', $main_domain);
$main_domain = $arr[0];
}
}
define('__MY_MAIN_DOMAIN__', $main_domain);