怎么根据来访者IP跳转到不同的页面?

    实现代码如下:


    $ip AIn" style="overflow-wrap: break-word; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; min-height: auto !important; color: black !important;">= 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 "上海";
    $contrastrstr($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.某某站.com/");
    exit;
    }
     

    这样写好后放到首页就能实现判断跳转了,