ไปโหลดมาใช้กันได้เลย ตามลิ้งค์นี้
เอาเฉพาะ โค้ตไฟล์ Mobile_Detect.php
วิธีใช้งานไม่ยุ่งยาก ไม่กี่บรรทัด
1 2 3 | <?php include "Mobile_Detect.php" ; $detect = new Mobile_Detect(); |
ใช้งานเบื้องต้น ตรวจสอบว่าเป็น มือถือ หรือแท็บเล็ต
1 2 3 4 5 6 7 8 9 | <?php if ( $detect ->isMobile()) { // Any mobile device. } <?php if ( $detect ->isTablet()){ // Any tablet device. } |
เช็คการใช้งานแบบเฉพาะเจาะจง
1 2 3 4 5 6 7 8 9 | <?php if ( $detect ->isiOS()){ // Code to run for the Apple iOS platform. } <?php if ( $detect ->isAndroidOS()){ // Code to run for the Google Android platform. } |
ต้วอย่างการเอาไปใช้งานในไฟล์ php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <?php include "Mobile_Detect.php" ; $detect = new Mobile_Detect(); if ( $detect ->isTablet()){ echo "<meta http-equiv=" refresh " content=" 0;URL= ".$URL." " />" ; exit ; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <head> <meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" /> <title></title> </head> <body> </body> </html> |
อ่านเพิ่มเติมที่หน้า ที่มา ตามลิ้งค์ข้างต้น