which is the better way to get the ip

前端 未结 6 1212
闹比i
闹比i 2020-12-21 05:30

What is the better way of getting the IP address in PHP:

getenv(\'REMOTE_ADDR\'); 

or,

$_SERVER[\'REMOTE_ADDR\'];
         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-21 05:54

    It would probably be better to use $_SERVER['REMOTE_ADDR']; to prevent incompatibilities between servers.

提交回复
热议问题