[PHP] to Detect if browser is mobile
Use PHP to detect if browser is mobile
Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
Download from the following link.
https://github.com/serbanghita/Mobile-Detect/tags
How to use in php code
require_once '../Mobile_Detect.php';Source from: https://github.com/serbanghita/Mobile-Detect
$detect = new Mobile_Detect;
if($detect->isMobile() ){
// is mobile
}else if($detect->isTablet()){
// is tablet
}else{
// is computer
}
留言
張貼留言