zoukankan      html  css  js  c++  java
  • php判断是PC访问网址,是手机跳到M站点

    <?php
    function zzk_check_phone_agent(){
      if(stristr($_SERVER['HTTP_VIA'],"wap")){// 先检查是否为wap代理,准确度高
            return true;
      }elseif(strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0){// 检查浏览器是否接受 WML.
            return true;
      }elseif(preg_match('/(blackberry|htc |htc_|htc-|motorola|nokia|opera mini|android|iphone|ipod|sonyericsson|symbian|up.browser|up.link|windows ce|windows mobile)/i', $_SERVER['HTTP_USER_AGENT'])){//检查USER_AGENT
            return true;
      }else{
            return false;
       }
    }
    if(zzk_check_phone_agent()){
        echo '<script>';
        echo 'window.location="http://m.baidu.cn"';
        echo '</script>';
        exit();
    }
    ?>
    
    


    原文链接: [url]http://www.lllomh.com/life/2018-01-08/174.html[/url]

  • 相关阅读:
    Spring 中各种通知
    Spring 中的注解
    Spring_DI利用set方法赋值Demo
    Beta冲刺总结
    用户使用调查报告
    Beta(7/7)
    Beta(6/7)
    Beta(5/7)
    Beta(4/7)
    Beta(3/7)
  • 原文地址:https://www.cnblogs.com/lllomh/p/14991924.html
Copyright © 2011-2022 走看看