微博客
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <style type="text/css">  
	body{font-size:20px;text-align:center}
   #foo{  
     color:red;  
    }  
  </style>  
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
<script  src="https://ipip.yy.com/get_ip_info.php"></script>
<script type="text/javascript">
$(document).ready(function(e) {
var city=returnInfo.city||returnInfo.province||"国产";
var  content= $("body").html().replace(/\{city\}/gi,city);
  $("body").html(content)
});
</script>
<script>

</script>
	<title>飞鸟制作,必属精品</title>
</head>

<body>
<div id="foo">飞鸟在{city},你也在{city}吧?真是缘分呀!<br/>这个热心的二货,自己都还没把网站弄好,就分享了{city}竞价前沿代码哟!</div>

</body>

 直接在页面上插入 {city} 标签,即可替换成访客的所属城市。(借用的是YY的Ip池)

另外,再备注一个淘宝IP地址库的链接:http://ip.taobao.com/index.php,淘宝Ip地址库(http://ip.taobao.com//service/getIpInfo.php?ip=112.230.227.77)输出json格式,可以用来输出任意网站的国家 、省(自治区或直辖市)、市(县)、运营商

posted on 2017-07-06 17:35  飞鸟42  阅读(1505)  评论(0编辑  收藏  举报