首页 > 后端开发 > php教程 > php 获取当前用户的IP,php当前用户ip_PHP教程

php 获取当前用户的IP,php当前用户ip_PHP教程

WBOY
发布: 2016-07-12 08:51:32
原创
1109 人浏览过

php 获取当前用户的IP,php当前用户ip

代码如下:

<?<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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1130142.htmlTechArticlephp 获取当前用户的IP,php当前用户ip 代码如下: ? php if ( $_SERVER ['HTTP_CLIENT_IP' ]){ $onlineip = $_SERVER ['HTTP_CLIENT_IP' ];} elseif ( $_SERVER ['HTTP_X_FORW...
相关标签:
php
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板