Heim > Artikel > Backend-Entwicklung > php 获取当前用户的IP,php当前用户ip_PHP教程
代码如下:
<?<span>php </span><span>if</span>(<span>$_SERVER</span>['HTTP_CLIENT_IP'<span>]){ </span><span>$onlineip</span>=<span>$_SERVER</span>['HTTP_CLIENT_IP'<span>]; }</span><span>elseif</span>(<span>$_SERVER</span>['HTTP_X_FORWARDED_FOR'<span>]){ </span><span>$onlineip</span>=<span>$_SERVER</span>['HTTP_X_FORWARDED_FOR'<span>]; }</span><span>else</span><span>{ </span><span>$onlineip</span>=<span>$_SERVER</span>['REMOTE_ADDR'<span>]; } </span><span>/*</span><span> 何问起 hovertree.com </span><span>*/</span> <span>echo</span> <span>$onlineip</span><span>; </span>?>
推荐:http://www.cnblogs.com/roucheng/p/phpexcel.html