Mobile_Detect is a lightweight, open-source mobile phone detection PHPClass. it uses strings in the User-Agent and uses HTTPHeader to detect the mobile device environment. The most powerful part of the PHP class library detected by this device is that it has a very... "/> <scripttype =" text/javascript"
Mobile_Detect is a lightweight open-source mobile device (mobile phone) detection PHP Class,
It uses a string in the User-Agent and HTTP Header to detect the mobile device environment.
The most powerful part of the PHP class library detected by this device is that it has a very complete library,
You can detect the device type (including the operation type and mobile phone brand) and the browser details.
The complete Mobile_Detect code is as follows:
include 'Mobile_Detect.php';$detect = new Mobile_Detect(); // Check for any mobile device.if ($detect->isMobile()) // Check for any tablet.if($detect->isTablet()) // Check for any mobile device, excluding tablets.if ($detect->isMobile() && !$detect->isTablet()) if ($detect->isMobile() && !$detect->isTablet()) // Alternative to $detect->isAndroidOS()$detect->is('AndroidOS'); // Batch usageforeach($userAgents as $userAgent){ $detect->setUserAgent($userAgent); $isMobile = $detect->isMobile();} // Version check.$detect->version('iPad'); // 4.3 (float)