本站资源均来自互联网,仅供学习与参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
Copyright @ 2015-2020 织梦园 版权所有
Power by DedeCms
鲁ICP备15039853号-1
鲁公网安备 37132302000249号
模板标签 TAG标签 网站地图 XML地图 今日更新 返回顶部
$ip = getIp();//dede自带的查询IP功能,直接调用 $res1 = file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=$ip"); $res1 = json_decode($res1); $useraddre = $res1->data->region; $useraddre = mb_convert_encoding($useraddre, "GBK", "UTF-8"); $dzcity = "北京"; $contra= strstr($useraddre,$dzcity); if(!emptyempty($contra)){ //南昌的,跳转到这里 header("Pragma: no-cache"); header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); header('HTTP/1.1 301 Moved Permanently'); header("Location: http://www.yourweb.com/"); exit; } |
上面这段代码,是北京访问者就会跳转到yourweb.com的网站上面啦,如果你需要对网站首页设置多个跳转的话,那么就多增加个城市判断即可。