zoukankan      html  css  js  c++  java
  • 判断是否手机端

    /**
    * 是否是手机设备浏览
    * @param string $user_agent 代理参数
    * @return boolean 返回布尔值
    */
    function is_mobile($user_agent){
    $user_agent = strtolower($user_agent);
    $is_mobile = false;
    $mobile_browser = Array(
    "mqqbrowser", //手机QQ浏览器
    "opera mobi", //手机opera
    "juc","iuc",//uc浏览器
    "fennec","ios","applewebKit/420","applewebkit/525","applewebkit/532","ipad","iphone","ipaq","ipod",
    "iemobile", "windows ce",//windows phone
    "240×320","480×640","acer","android","anywhereyougo.com","asus","audio","blackberry","blazer","coolpad" ,"dopod", "etouch", "hitachi","htc","huawei", "jbrowser", "lenovo","lg","lg-","lge-","lge", "mobi","moto","nokia","phone","samsung","sony","symbian","tablet","tianyu","wap","xda","xde","zte"
    );
    //是否在手机设备中
    foreach ($mobile_browser as $device) {
    if (stristr($user_agent, $device)) {
    $is_mobile = true;
    break;
    }
    }
    return $is_mobile;
    }

    is_mobile($_SERVER['HTTP_USER_AGENT'])  //返回true   false

  • 相关阅读:
    实验三
    第四次实验
    作业
    第二次实验
    <转>JVM调优
    SQL Server的聚集索引和非聚集索引
    去除DataTable里面重复的数据
    sql server 与 Excel 导入导出
    C#学习笔记 委托和事件
    好多特效
  • 原文地址:https://www.cnblogs.com/jierong12/p/9019355.html
Copyright © 2011-2022 走看看