Frédéric Olivier :: Développeur Web

25 octobre 2011 Détection Mobile Web en PHP : Mobile_Detect

Mobile_Detect is a simple PHP class for easy detection of the most popular mobile platforms: Android, iPhone, Blackberry, Opera Mini, Palm, Windows Mobile, as well as generic ones.
Usage

Include and instantiate the class:
include("Mobile_Detect.php");
$detect = new Mobile_Detect();


Check for a specific platform:
if ($detect->isAndroid()) {
// code to run for the Google Android platform
}


Available methods are isAndroid(), isAndroidtablet(), isIphone(), isIpad(), isBlackberry(), isBlackberrytablet(), isPalm(), isWindowsphone(), isWindows(), isGeneric(). Alternatively, if you are only interested in checking to see if the user is using a mobile device, without caring for specific platform:
if ($detect->isMobile()) {
// any mobile platform
}

Contact

Communiquer avec moi par courriel à l'adresse folivier « A commercial » f0.ca

Veille Techno


Cadouri de Craciun