Maison >développement back-end >tutoriel php >本地安装 链接的端口号重复 怎么破
<code> 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; } </code>
问题在第五行$_SERVER['HTTP_HOST']本身带端口号