资讯专栏INFORMATION COLUMN

判断来访客服端是否是移动设备

UsherChen / 1639人阅读

摘要:方法判断是否属手机调用您使用的是移动设备访问

方法

//判断是否属手机
function is_mobile() {
    $user_agent = $_SERVER["HTTP_USER_AGENT"];
    $mobile_agents = Array("240x320","acer","acoon","acs-","abacho","ahong","airness","alcatel","amoi","android","anywhereyougo.com","applewebkit/525","applewebkit/532","asus","audio","au-mic","avantogo","becker","benq","bilbo","bird","blackberry","blazer","bleu","cdm-","compal","coolpad","danger","dbtel","dopod","elaine","eric","etouch","fly ","fly_","fly-","go.web","goodaccess","gradiente","grundig","haier","hedy","hitachi","htc","huawei","hutchison","inno","ipad","ipaq","ipod","jbrowser","kddi","kgt","kwc","lenovo","lg ","lg2","lg3","lg4","lg5","lg7","lg8","lg9","lg-","lge-","lge9","longcos","maemo","mercator","meridian","micromax","midp","mini","mitsu","mmm","mmp","mobi","mot-","moto","nec-","netfront","newgen","nexian","nf-browser","nintendo","nitro","nokia","nook","novarra","obigo","palm","panasonic","pantech","philips","phone","pg-","playstation","pocket","pt-","qc-","qtek","rover","sagem","sama","samu","sanyo","samsung","sch-","scooter","sec-","sendo","sgh-","sharp","siemens","sie-","softbank","sony","spice","sprint","spv","symbian","tablet","talkabout","tcl-","teleca","telit","tianyu","tim-","toshiba","tsm","up.browser","utec","utstar","verykool","virgin","vk-","voda","voxtel","vx","wap","wellco","wig browser","wii","windows ce","wireless","xda","xde","zte");
    $is_mobile = false;
    foreach ($mobile_agents as $device) {
        if (stristr($user_agent, $device)) {
            $is_mobile = true;
            break;
        }
    }
    return $is_mobile;
}

调用

if( is_mobile() ){
    echo "您使用的是移动设备访问";
}

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/30368.html

相关文章

  • php 判断来访客户端移动设备

    摘要:判断是否属手机使用您使用的是移动设备访问 //判断是否属手机 function is_mobile() { $user_agent = $_SERVER[HTTP_USER_AGENT]; $mobile_agents = Array(240x320,acer,acoon,acs-,abacho,ahong,airness,alcatel,amoi,android,an...

    lentoo 评论0 收藏0
  • 常见https,SSH协议和MD5加密方式分析

    摘要:前言协议和加密是前端可能会接触到的加密所以我就将他们进行了一个归纳原理就是在加入层是安全的基础协议是在基础上加了协议使用端口是端口由网景公司开发并内置在浏览器中作用建立一个信息安全通道来保证数据传输的安全确认网站的真实性可以查看网站认证的真 前言 https,SSH协议和MD5加密是前端可能会接触到的加密,所以我就将他们进行了一个归纳. 1.https 1.1原理 A.就是在http加...

    3fuyu 评论0 收藏0
  • 常见https,SSH协议和MD5加密方式分析

    摘要:前言协议和加密是前端可能会接触到的加密所以我就将他们进行了一个归纳原理就是在加入层是安全的基础协议是在基础上加了协议使用端口是端口由网景公司开发并内置在浏览器中作用建立一个信息安全通道来保证数据传输的安全确认网站的真实性可以查看网站认证的真 前言 https,SSH协议和MD5加密是前端可能会接触到的加密,所以我就将他们进行了一个归纳. 1.https 1.1原理 A.就是在http加...

    Alfred 评论0 收藏0
  • Vue+Koa+Mongodb 小练习

    摘要:小练习作者本文首发博客功能基于进行登录,注册,留言的简单网站。所以这个小练习,从一个简单的方面入手,希望能给踩过同样多坑的同路人一点启发。就意味着要重新登录。的作用是进行进程守护,当你的意外的停止的时候,进行重启。 Vue+Koa+Mongodb 小练习 作者: Pawn 本文首发: Pawn博客 功能: 基于vue koa mongodb进行登录,注册,留言的简单网站。 体验地址: ...

    赵春朋 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<