/**
     * HTTP_HOST = SERVER_NAME:SERVER_PORT
     * 获取当前的host
     */
    public static function getSelfHost() {
        setlog($_SERVER,$_SERVER['HTTP_HOST'],$_SERVER['SERVER_NAME'],'server.log');

        $port = $_SERVER['SERVER_PORT'];
        $http_host = $_SERVER['HTTP_HOST'];
        if ($port == 80 || $port == 443) {
            $host = 'http://' . $http_host . '/';
        } else {
            $host = 'http://'. $http_host .':'.$port.'/';
        }


//        $host = 'http://' . $http_host . '/';
        return $host;
    }

相关文章:

  • 2021-06-03
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-27
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-12-30
相关资源
相似解决方案