แนะนำ Mobile Detect php class พร้อมใช้ เช็คการใช้งาน ผ่าน มือถือ แท็บเล็ต

เขียนเมื่อ 11 ปีก่อน โดย Ninenik Narkdee
php mobile detect mobile

คำสั่ง การ กำหนด รูปแบบ ตัวอย่าง เทคนิค ลูกเล่น การประยุกต์ การใช้งาน เกี่ยวกับ php mobile detect mobile

ดูแล้ว 17,733 ครั้ง


 ไปโหลดมาใช้กันได้เลย ตามลิ้งค์นี้

 
เอาเฉพาะ โค้ตไฟล์ Mobile_Detect.php
 
 
วิธีใช้งานไม่ยุ่งยาก ไม่กี่บรรทัด 
 
<?php
include "Mobile_Detect.php";
$detect = new Mobile_Detect();
 
 
ใช้งานเบื้องต้น ตรวจสอบว่าเป็น มือถือ หรือแท็บเล็ต
<?php
if ($detect->isMobile()) {
    // Any mobile device.
}
 
<?php
if($detect->isTablet()){
    // Any tablet device.
}
 
 
เช็คการใช้งานแบบเฉพาะเจาะจง
 
<?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 
<?php
include "Mobile_Detect.php";
$detect = new Mobile_Detect();
if($detect->isTablet()){
$URL="https://www.ninenik.com/tablet/";	
echo "<meta http-equiv="refresh" content="0;URL=".$URL."" />";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>

<body>
</body>
</html>
 
 
อ่านเพิ่มเติมที่หน้า ที่มา ตามลิ้งค์ข้างต้น


กด Like หรือ Share เป็นกำลังใจ ให้มีบทความใหม่ๆ เรื่อยๆ น่ะครับ











URL สำหรับอ้างอิง





คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )







เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ