1:语言用的是php的语言;
2:IP库用的是淘宝的ip库,参考网址:http://ip.taobao.com/index.php
3:代码如下:
<?php function getipCity($ip) { //echo "ip is".$ip; $url="http://ip.taobao.com/service/getIpInfo.php?ip=".$ip; $ip = json_decode(file_get_contents($url)); if ((string)$ip->code == '1'){ return false; } $data = (array)$ip->data; return $data; } $userip = $_SERVER['REMOTE_ADDR']; $info = getipCity($userip); //echo $info[country]; if ($info[country] == "中国") { $url = "index_cn.php"; echo "<script language='javascript' type='text/javascript'>"; echo "window.location.href='$url'"; echo "</script>"; } else { $url = "index_en.php"; echo "<script language='javascript' type='text/javascript'>"; echo "window.location.href='$url'"; echo "</script>"; } ?>
文章的脚注信息由WordPress的wp-posturl插件自动生成