Home > php教程 > php手册 > 获取用户客户端的真实ip地址

获取用户客户端的真实ip地址

WBOY
Release: 2016-06-07 11:38:31
Original
1189 people have browsed it

有些内置的函数无法获取用户客户端真是的ip地址,而在实际运用中,我们这个用到的相对来说还是比较频繁的,那么有什么方法来解决这个呢?答案就在下方!
function getipinfo(){<br>     header("Content-Type:text/html;   charset=utf-8");<br>     $url = 'http://1111.ip138.com/ic.asp';  //这儿填页面地址<br>     $info=httpGet($url);<br>     $p = "%<center>(.*?)</center>%si";<br>     preg_match_all($p, $info, $arr);<br>     <br>     $info=$arr[1];<br>     $str1 = explode("[",iconv('GB2312', 'UTF-8',$info[0]));<br>     $str2 = explode("]",$str1[1]);<br>     $ip=$str2[0].'_'.substr($str2[1],10);<br>     return $ip;<br> }原文来自:http://www.580bang.com/?post=2

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template