前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Github项目Mobile-Detect-检测移动设备的php类

Github项目Mobile-Detect-检测移动设备的php类

作者头像
HHTjim 部落格
发布2022-09-26 11:01:15
3700
发布2022-09-26 11:01:15
举报
文章被收录于专栏:HHTjim'S 部落格

Github项目Mobile-Detect-检测移动设备的php类

作者:matrix 被围观: 2,063 次 发布时间:2015-01-14 分类:兼容并蓄 | 2 条评论 »

这是一个创建于 2787 天前的主题,其中的信息可能已经有所发展或是发生改变。

Mobile-Detect php类可以检测是否为移动设备,不用你自己写代码判断ua。它使用 User-Agent 中的字符串,并结合 HTTP Header,来检测移动设备环境,比较靠谱。

网盘备份:http://pan.baidu.com/s/1pJBMFe7

Github地址:https://github.com/serbanghita/[Mobile-Detect](https://www.hhtjim.com/tag/mobile-detect)

官网:http://mobiledetect.net/

DEMO:http://demo.mobiledetect.net/

函数示例

代码语言:javascript
复制
// 载入并实例化类
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// 移动设备 (手机和平板).
if ( $detect->isMobile() )
//平板设备
if( $detect->isTablet() )
// 判断os
if( $detect->isiOS() )
if( $detect->isAndroidOS() )
...
// 其他的
$detect->is('Chrome')
$detect->is('iOS')
$detect->is('UC Browser')
...

说明:更多的函数请查看DEMO处

参考:

http://mobiledetect.net/

http://yusi123.com/2607.html

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Github项目Mobile-Detect-检测移动设备的php类
    • 函数示例
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档