php 获取当前IP地址

function getIP() {
    return isset($_SERVER["HTTP_X_FORWARDED_FOR"])?$_SERVER["HTTP_X_FORWARDED_FOR"]
        :(isset($_SERVER["HTTP_CLIENT_IP"])?$_SERVER["HTTP_CLIENT_IP"]
            :$_SERVER["REMOTE_ADDR"]);
}

  

posted @ 2018-07-09 18:04  Func~  阅读(390)  评论(0编辑  收藏  举报