post item
2018年09月01日 17:19:30

PHP 获取真实IP

Galgame_News


public function getIp()    {        $ip = '';        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];        } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {            $ip = $_SERVER['HTTP_CLIENT_IP'];        } else {            $ip = $_SERVER['REMOTE_ADDR'];        }        $ip_arr = explode(',', $ip);        return $ip_arr[0];    }

 发布者!!

Comments

Leave a comment

Loading