Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
429 views
in Technique[技术] by (71.8m points)

typecho非80端口安装地址获取错误

本地使用8080端口的WAMP安装typecho,安装后链接的URL地址都被设置了localhost:8080:8080,导致无法正常访问;

设置的网站地址:
图片描述

安装后生成的连接错误:
图片描述

各位有碰到过类似情况的,麻烦提供下经验。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

后续自己看了下代码,解决方法如下:
修改var/typecho/request.php文件的getUrlPrefix()方法:

 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;
    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...