检测手机设备种类的PHP类下载 – php-mobile-detect

  •   
  • 4069
  • PHP
  • 8
  • super_dodo
  • 2015/01/23

移动互联网时代怎能一个网站只有Web页呢,所以要学习并解决一个网站在不同设备上的显示效果,已达到用户的良好体验。现在很多优秀的国外的网站或者模板都是使用到了检测手机设备种类的 PHP 类 - php-mobile-detect。国外的直接饮用google的代码地址即可。但是在国内因为访问google受限制,所以严重影响用户的体验。但是可以去 http://mobiledetect.net 这个官方网站上下载。下载之后相关的文档和说明都还是很详尽的。相信你会喜欢上这个手机设备种类的 PHP检测类。

php-mobile-detect 是一个 PHP 类,用来通过 User-Agent 检测各种手机设备。

include("Mobile_Detect.php");
$detect = new Mobile_Detect();
if($detect->iOS()){
    // code to run for the Apple iOS platform.
}
if($detect->isAndroidOS()){
    // code to run for the Google Android platform.
}
if ($detect->isMobile()) {
    // any mobile platform
}
if($detect->isTablet()){
    // any tablet
}

各种检测的方法列表如下 也可以直接访问作者的demo页面 http://demo.mobiledetect.net/

Supported methods

Basic detection methods
isMobile()	bool(false)
isTablet()	bool(false)
Custom detection methods
isiPhone()	bool(false)
isBlackBerry()	bool(false)
isHTC()	bool(false)
isNexus()	bool(false)
isDell()	bool(false)
isMotorola()	bool(false)
isSamsung()	bool(false)
isLG()	bool(false)
isSony()	bool(false)
isAsus()	bool(false)
isMicromax()	bool(false)
isPalm()	bool(false)
isVertu()	bool(false)
isPantech()	bool(false)
isFly()	bool(false)
isiMobile()	bool(false)
isSimValley()	bool(false)
isWolfgang()	bool(false)
isAlcatel()	bool(false)
isNintendo()	bool(false)
isAmoi()	bool(false)
isINQ()	bool(false)
isGenericPhone()	bool(false)
isiPad()	bool(false)
isNexusTablet()	bool(false)
isSamsungTablet()	bool(false)
isKindle()	bool(false)
isSurfaceTablet()	bool(false)
isHPTablet()	bool(false)
isAsusTablet()	bool(false)
isBlackBerryTablet()	bool(false)
isHTCtablet()	bool(false)
isMotorolaTablet()	bool(false)
isNookTablet()	bool(false)
isAcerTablet()	bool(false)
isToshibaTablet()	bool(false)
isLGTablet()	bool(false)
isFujitsuTablet()	bool(false)
isPrestigioTablet()	bool(false)
isLenovoTablet()	bool(false)
isDellTablet()	bool(false)
isYarvikTablet()	bool(false)
isMedionTablet()	bool(false)
isArnovaTablet()	bool(false)
isIntensoTablet()	bool(false)
isIRUTablet()	bool(false)
isMegafonTablet()	bool(false)
isEbodaTablet()	bool(false)
isAllViewTablet()	bool(false)
isArchosTablet()	bool(false)
isAinolTablet()	bool(false)
isSonyTablet()	bool(false)
isPhilipsTablet()	bool(false)
isCubeTablet()	bool(false)
isCobyTablet()	bool(false)
isMIDTablet()	bool(false)
isMSITablet()	bool(false)
isSMiTTablet()	bool(false)
isRockChipTablet()	bool(false)
isFlyTablet()	bool(false)
isbqTablet()	bool(false)
isHuaweiTablet()	bool(false)
isNecTablet()	bool(false)
isPantechTablet()	bool(false)
isBronchoTablet()	bool(false)
isVersusTablet()	bool(false)
isZyncTablet()	bool(false)
isPositivoTablet()	bool(false)
isNabiTablet()	bool(false)
isKoboTablet()	bool(false)
isDanewTablet()	bool(false)
isTexetTablet()	bool(false)
isPlaystationTablet()	bool(false)
isTrekstorTablet()	bool(false)
isPyleAudioTablet()	bool(false)
isAdvanTablet()	bool(false)
isDanyTechTablet()	bool(false)
isGalapadTablet()	bool(false)
isMicromaxTablet()	bool(false)
isKarbonnTablet()	bool(false)
isAllFineTablet()	bool(false)
isPROSCANTablet()	bool(false)
isYONESTablet()	bool(false)
isChangJiaTablet()	bool(false)
isGUTablet()	bool(false)
isPointOfViewTablet()	bool(false)
isOvermaxTablet()	bool(false)
isHCLTablet()	bool(false)
isDPSTablet()	bool(false)
isVistureTablet()	bool(false)
isCrestaTablet()	bool(false)
isMediatekTablet()	bool(false)
isConcordeTablet()	bool(false)
isGoCleverTablet()	bool(false)
isModecomTablet()	bool(false)
isVoninoTablet()	bool(false)
isECSTablet()	bool(false)
isStorexTablet()	bool(false)
isVodafoneTablet()	bool(false)
isEssentielBTablet()	bool(false)
isRossMoorTablet()	bool(false)
isiMobileTablet()	bool(false)
isTolinoTablet()	bool(false)
isAudioSonicTablet()	bool(false)
isAMPETablet()	bool(false)
isSkkTablet()	bool(false)
isTecnoTablet()	bool(false)
isJXDTablet()	bool(false)
isiJoyTablet()	bool(false)
isFX2Tablet()	bool(false)
isXoroTablet()	bool(false)
isViewsonicTablet()	bool(false)
isOdysTablet()	bool(false)
isCaptivaTablet()	bool(false)
isIconbitTablet()	bool(false)
isTeclastTablet()	bool(false)
isJaytechTablet()	bool(false)
isBlaupunktTablet()	bool(false)
isDigmaTablet()	bool(false)
isEvolioTablet()	bool(false)
isLavaTablet()	bool(false)
isCelkonTablet()	bool(false)
isMiTablet()	bool(false)
isNibiruTablet()	bool(false)
isNexoTablet()	bool(false)
isUbislateTablet()	bool(false)
isPocketBookTablet()	bool(false)
isHudl()	bool(false)
isTelstraTablet()	bool(false)
isGenericTablet()	bool(false)
isAndroidOS()	bool(false)
isBlackBerryOS()	bool(false)
isPalmOS()	bool(false)
isSymbianOS()	bool(false)
isWindowsMobileOS()	bool(false)
isWindowsPhoneOS()	bool(false)
isiOS()	bool(false)
isMeeGoOS()	bool(false)
isMaemoOS()	bool(false)
isJavaOS()	bool(false)
iswebOS()	bool(false)
isbadaOS()	bool(false)
isBREWOS()	bool(false)
isChrome()	bool(false)
isDolfin()	bool(false)
isOpera()	bool(false)
isSkyfire()	bool(false)
isIE()	bool(false)
isFirefox()	bool(false)
isBolt()	bool(false)
isTeaShark()	bool(false)
isBlazer()	bool(false)
isSafari()	bool(false)
isTizen()	bool(false)
isUCBrowser()	bool(false)
isbaiduboxapp()	bool(false)
isbaidubrowser()	bool(false)
isDiigoBrowser()	bool(false)
isPuffin()	bool(false)
isMercury()	bool(false)
isObigoBrowser()	bool(false)
isNetFront()	bool(false)
isGenericBrowser()	bool(false)
Experimental version() method
version(Chrome)	string(12) "39.0.2171.95"
version(Safari)	string(6) "537.36"
version(Webkit)	string(6) "537.36"
version(Windows NT)	string(3) "6.1"
Other tests
isiphone()	bool(false)
isIphone()	bool(false)
istablet()	bool(false)
isIOS()	bool(false)
isWhateverYouWant()	bool(false)

相关说明文档以及下载地址等.愿君多采颉~~~

Homepage:     http://mobiledetect.net
GitHub Repo:  https://github.com/serbanghita/Mobile-Detect
Google Code:  http://code.google.com/p/php-mobile-detect/
README:       https://github.com/serbanghita/Mobile-Detect/blob/master/README.md
HOWTO:        https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples

OK。。开始你的移动互联网之旅吧。。。旅途愉快。。。