PHP class library for detecting mobile devices (mobile phones)

Source: Internet
Author: User
Mobile_detect is a lightweight, open source mobile device (mobile phone) detection PHP Class that uses strings in User-agent and combines HTTP headers to detect the mobile device environment. The most powerful thing about the PHP class library that this device detects is that it has a very complete library that detects the type of device used (including the type of operation, as well as the ability of the phone's brand to detect) and the browser's details.

http://mobiledetect.net/

Use instance 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)

Source: http://www.oschina.net/code/snippet_118180_16788

The above describes the detection of mobile devices (mobile phone) PHP class library, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.