Mobile Detect là một thư viện PHP được dùng để xác định thiết bị truy cập dựa và User Agent và HTTP headers.
Trang chủ: http://mobiledetect.net/
Demo: http://demo.mobiledetect.net/
Download: https://github.com/serbanghita ... 4.zip
Code mẫu:
PHP
//đường dẫn tới file Mobile_Detect.php require_once('Mobile_Detect.php'); $detect = new Mobile_Detect; // Kiểm tra thiết bị di động (điện thoại hoặc tablet). if ( $detect->isMobile() ) { // Code cho thiết bị di động } else { // Code cho PC, laptop, ... } // kiểm tra tablet if( $detect->isTablet() ){ } // Ngoại trừ tablet if( $detect->isMobile() && !$detect->isTablet() ){ } // Kiểm tra iOS if( $detect->isiOS() ){ } // Kiểm tra Android if( $detect->isAndroidOS() ){ }
![[OFF]](/assets/images/off.gif)