Here to introduce a mobile device check class, from Google found Mobile-detect class, this class can be computed by CT scan Android, iOS, tablet tablet, browser, and other perfect judgment ipad,iphone,win8, etc.
How to use
The code is as follows |
Copy Code |
Include ' mobile_detect.php '; $detect = new Mobile_detect (); if ($detect->ismobile ()) { Any mobile device. }
if ($detect->istablet ()) { any tablet device. } Check for a specific platform: if ($detect->isios ()) { Code to run for the Apple ' s IOS platform. } if ($detect->isandroidos ()) { Code to run for the Google ' s Android platform. } |
Official examples
The code is as follows |
Copy Code |
Require_once ' mobile_detect.php '; $detect = new Mobile_detect; $deviceType = ($detect->ismobile ()? ($detect->istablet ()? ' Tablet ': ' Phone '): ' computer '); $scriptVersion = $detect->getscriptversion ();
?>
<title>Mobile Detect Local Demo</title>
This is a . Your UA is
Supported methods
Basic Detection Methods |
IsMobile () |
| IsMobile (); if ($check):? >class= "true" >
Istablet () |
| Istablet (); if ($check):? >class= "true" >
Custom Detection Methods |
GetRules () as $name + $regex): $check = $detect->{' is '. $name} ();?>
is () |
| Class= "true" >
experimental version () method |
!--? php foreach ($detect->getpro Perties () as $name + $match): $check = $detect->version ($name); if ($check!==false):?>
version (!--? php echo $name;?--) |
!--? php var_dump ($check); ?--> |
!--? php endif,?-->!--? php Endforeach;?-->
Other tests |
Isiphone () |
Isiphone ());?> |
Isiphone () |
Isiphone ());?> |
Istablet () |
Istablet ());?> |
Isios () |
Isios ());?> |
Iswhateveryouwant () |
Iswhateveryouwant ());?> |
|
Php-mobile-detect file download how to: Http://file.bKjia.c0m/upload/2013/10/M.rar
http://www.bkjia.com/PHPjc/632784.html www.bkjia.com true http://www.bkjia.com/PHPjc/632784.html techarticle here to introduce a mobile device check class, from Google to find the Mobile-detect class, this class can be computed by CT scan Android, iOS, tablet tablet, browser, and other relatively perfect sentence ...