PHP most accurate / safe way to get real user IP address in 2017

后端 未结 10 540
粉色の甜心
粉色の甜心 2021-01-01 15:51

What is the most accurate way to get user\'s IP address in 2017 via PHP?

I\'ve read a lot of SO questions and answers about it, but most of answers are old and comme

10条回答
  •  臣服心动
    2021-01-01 16:18

    Get Client IP Address:

    
    

    Note:: This would work only on live site, because on your local host your ip would be one (1) of the internal ip addresses, like 127.0.0.1 So, its Return ::1

    Example : https://www.virendrachandak.com/demos/getting-real-client-ip-address-in-php.php

    Its Show Your Local Ip: Like ... 78.57.xxx.xxx

    Example:

    
    

提交回复
热议问题