- <?php
- 一妹子问我的 说想了一天也想不出来 根据我的思路给搞了一个
- $myip = $_SERVER["REMOTE_ADDR"];
- $ipinfo=file_get_contents("http://www.youdao.com/smartresult-xml/search.s?type=ip&q=".$myip);
- if(strpos($ipinfo,'北京') > 1) {
- header('HTTP/1.1 301 Moved Permanently');
- header("Location: http://www.hao123.com");//如果用户ip为北京,则跳转页面
- }else{
- header('HTTP/1.1 301 Moved Permanently');
- header("Location: http://www.baidu.com");
- }
- ?>
转载于:https://blog.51cto.com/0x007/1135975