zoukankan      html  css  js  c++  java
  • php $_SERVER['HTTP_USER_AGENT'] 2

    //mobile  false pc   true no pc
        function is_mobile(){
            $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
            $is_pc = (strpos($agent, 'windows nt')) ? true : false;
            $is_mac = (strpos($agent, 'mac os')) ? true : false;
            /* $is_linux =    (strpos($agent, 'linux')) ? true : false;
            $is_unix =    (strpos($agent, 'unix')) ? true : false;
             */
            $is_iphone = (strpos($agent, 'iphone')) ? true : false;
            $is_android = (strpos($agent, 'android')) ? true : false;
            $is_ipad = (strpos($agent, 'ipad')) ? true : false;
            

            if($is_pc){
                  return  false;
            }
            
            if($is_mac){
                  return  true;
            }
            
            /* if($is_linux){
                  return  false;
            }
            
            if($is_unix){
                  return  false;
            } */
            
            if($is_iphone){
                  return  true;
            }
            
            if($is_android){
                  return  true;
            }
            
            if($is_ipad){
                  return  true;
            }
        }
        
        function infoAgent(){
            $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
            return $agent;
        }
        
        function is_iphone(){
            $info = false;
            if(strpos(tecrm::infoAgent(), 'iphone')){
                $info = "iphone";
            }
            return $info;
        }
        
        function is_android(){
            $info = false;
            if(strpos(tecrm::infoAgent(), 'android')){
                $info = "android";
            }
            return $info;
        }
        
        function is_ipad(){
            $info = false;
            if(strpos(tecrm::infoAgent(), 'ipad')){
                $info = "ipad";
            }
            return $info;
        }

  • 相关阅读:
    test
    设置section的距离
    UISearchBar的应用
    Centos6.6 系统优化
    Linux系统之间文件传输 scp 命令
    MySQL 数据库安装
    AWS中国EC2 公网IP登录免pemKEY修改shh 配置文件
    Ubuntu 16.04 Chrome浏览器安装flash player插件
    Centos6.6 yum源更新
    qume-kvm 命令管理
  • 原文地址:https://www.cnblogs.com/yuwensong/p/4060480.html
Copyright © 2011-2022 走看看