dedecms首页添加根据IP访问区域跳转对应页面的方法

织梦教程 强烈建议 2024-02-06 14:13 111 0

  $ip=getIp();//dede自带的查询IP功能,直接调用

  $res1=file_get_contents("");

  $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: ");

  exit;

  }



时间:(2024-02-06 14:13:52)
本站资源均来自互联网或会员发布,如果不小心侵犯了您的权益请与我们联系。我们将立即删除!谢谢!