绵阳做网站_绵阳网站建设公司_绵阳网页制作_绵阳网页设计_绵阳网站制作设计公司

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 10219|回复: 1

判断手机登陆跳转

[复制链接]
发表于 2012-11-14 10:11:21 | 显示全部楼层 |阅读模式
  1. <?php
  2. function checkmobile() {
  3.     global $_G;
  4.     $mobile = array();
  5.     static $mobilebrowser_list =array('iphone','android','phone','mobile','wap','netfront','java','opera mobi','opera mini','ucweb','windows ce','symbian','series','webos','sony','blackberry','dopod','nokia','samsung','palmsource','xda','pieplus','meizu','midp','cldc','motorola','foma','docomo','up.browser','up.link','blazer','helio','hosin','huawei','novarra','coolpad','webos','techfaith','palmsource','alcatel','amoi','ktouch','nexian','ericsson','philips','sagem','wellcom','bunjalloo','maui','smartphone','iemobile','spice','bird','zte-','longcos','pantech','gionee','portalmmm','jig browser','hiptop','benq','haier','^lct','320x320','240x320','176x220');
  6.     $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
  7.     if(($v = dstrpos($useragent,$mobilebrowser_list,true))) {
  8.         $_G['mobile'] = $v;
  9.         return true;
  10.     }
  11.     $brower = array('mozilla','chrome','safari','opera','m3gate','winwap','openwave','myop');
  12.     if(dstrpos($useragent,$brower)) return false;

  13.     $_G['mobile'] = 'unknown';
  14.     if($_GET['mobile'] === 'yes') {
  15.         return true;
  16.     } else {
  17.         return false;
  18.     }
  19. }

  20. function dstrpos($string,&$arr,$returnvalue = false) {
  21.     if(empty($string)) return false;
  22.     foreach((array)$arr as $v) {
  23.         if(strpos($string,$v) !== false) {
  24.             $return = $returnvalue ? $v : true;
  25.             return $return;
  26.         }
  27.     }
  28.     return false;
  29. }
  30. if(checkmobile()){
  31. header("Location:http://xahrh.a.sankai.com");//手机登陆跳转页面
  32. }
  33. ?>
复制代码


绵阳网站建设 | 绵阳做网站 —— 剑锋所指 所向披靡!
 楼主| 发表于 2012-11-24 10:26:24 | 显示全部楼层
Mobile-Detect
mobile_device_detect.php
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|绵阳网站建设

GMT+8, 2024-11-5 18:49 , Processed in 0.041233 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表