php获取id

    private static function getClientIp()
    {
        if (getenv('HTTP_X_FORWARDED_FOR')) {
            $tmp = explode(',', getenv('HTTP_X_FORWARDED_FOR'));
            $onlineip = $tmp[0];
        } elseif (getenv('HTTP_REMOTEIP')) {
            $onlineip = getenv('HTTP_REMOTEIP');
        } elseif (getenv('HTTP_CLIENT_IP')) {
            $onlineip = getenv('HTTP_CLIENT_IP');
        } elseif (getenv('REMOTE_ADDR')) {
            $onlineip = getenv('REMOTE_ADDR');
        } else {
            $onlineip = '127.0.0.1';
        }

        return $onlineip;
    }

 

posted @ 2019-04-26 19:12  泥土里的绽放  阅读(467)  评论(0编辑  收藏  举报