正文 532字数 29,464阅读

php-mobile-detect (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 }
Run code
Cut to clipboard