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 ('androiddos '); // Batch usageforeach ($ userAgents as $ userAgent) {$ detect-> setUserAgent ($ userAgent); $ isMobile = $ detect-> isMobile ();} // Version check. $ detect-> version ('ipad '); // 4.3 (float)