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

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

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

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

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

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

Github地址:https://github.com/serbanghita/Mobile-Detect
官网:http://mobiledetect.net/
DEMO:http://demo.mobiledetect.net/

函数示例

// 载入并实例化类
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

其他文章:
本文固定链接:https://www.hhtjim.com/making-project-mobile-detect-testing-php-classes-of-mobile-devices.html
matrix
本文章由 matrix 于2015年01月14日发布在兼容并蓄分类下,目前没有通告,你可以至底部留下评论。
转载请注明:Github项目Mobile-Detect-检测移动设备的php类-HHTjim'S 部落格
关键字:, , ,

有2 条评论 »

  1. 未知路 未知路 2015-3-3 16:46:13 +0800#1

    收集了这么多UA我也是醉了。。

    • Matrix Matrix Moderator 2015-3-4 12:02:47 +0800

      能造福大众就行 。

添加新评论 »

 🙈 😱 😂 😛 😭 😳 😀 😆 👿 😉 😯 😮 😕 😎 😐 😥 😡 😈 💡

插入图片

NOTICE: You should type some Chinese word (like “你好”) in your comment to pass the spam-check, thanks for your patience!