首页 > 移动平台 > 详细

移动设备检测类Mobile_Detect.php

时间:2017-02-14 21:55:45      阅读:148      评论:0      收藏:0      [点我收藏+]

移动设备检测类Mobile_Detect.php

 

http://mobiledetect.net/

分类:PHP 时间:2015年11月28日

Mobile_Detect.php是一个轻量级的开源移动设备检测的PHP Class。它使用User-Agent中的字符串,并结合 HTTP Header来检测移动设备环境。Mobile_Detect.php有一个非常完整的移动设备库,可以检测出所用的设备类型(包括操作系统类型,以及手机品牌等都能检测)和浏览器User-Agent的详细信息。

1、引入Mobile_Detect.php

1
require_once ‘Mobile_Detect.php‘;

2、实例化Mobile_Detect类

1
$detect new Mobile_Detect();

3、调用Mobile_Detect类里的方法和属性

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//平板设备
if$detect->isTablet(){
}
//移动设备但非平板
if$detect->isMobile(&& !$detect->isTablet(){
}
//IOS系统
if$detect->isiOS(){
}
//Android系统
if$detect->isAndroidOS(){
}
//WindowsPhone系统
if$detect->isWindowsPhoneOS(){
}

Mobile_Detect官方主页:http://mobiledetect.net/

 

 

标签:

移动设备检测类Mobile_Detect.php

原文:http://www.cnblogs.com/clphp/p/6399180.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!