本地安装 链接的端口号重复 怎么破
程序员文章站
2024-01-04 10:16:09
...
回复内容:
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']本身带端口号