时间:2021-07-01 10:21:17 帮助过:38人阅读
public static function getUrlPrefix()
{
if (empty(self::$_urlPrefix)) {
self::$_urlPrefix = (self::isSecure() ? 'https' : 'http')
. '://' . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])
. (in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? '' : ':' . $_SERVER['SERVER_PORT']);
}
return self::$_urlPrefix;
}
问题在第五行$_SERVER['HTTP_HOST']本身带端口号