Home >Backend Development >PHP Tutorial >本地安装 链接的端口号重复 怎么破

本地安装 链接的端口号重复 怎么破

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:38:311261browse

本地安装 链接的端口号重复 怎么破

回复内容:

本地安装 链接的端口号重复 怎么破

<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']本身带端口号

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn