当前位置 : 主页 > 网络编程 > PHP >

ip.php

来源:互联网 收集:自由互联 发布时间:2021-06-28
ip.php /** * 获取客服端ip * @return string */ public static function getIp() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { return $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORVARDED_FOR'])) { return $_SERVER['HTTP_X_F
ip.php
/**
     * 获取客服端ip
     * @return string
     */
    public static function getIp()
    {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            return $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORVARDED_FOR'])) {
            return $_SERVER['HTTP_X_FORVARDED_FOR'];
        } elseif (!empty($_SERVER['REMOTE_ADDR'])) {
            return $_SERVER['REMOTE_ADDR'];
        } else {
            return "未知IP";
        }
    }
上一篇:autoload.php
下一篇:仓库模式基类
网友评论