모바일 장치(휴대폰) 감지를 위한 PHP 클래스 라이브러리

WBOY
풀어 주다: 2016-08-08 09:24:43
원래의
984명이 탐색했습니다.

Mobile_Detect는 경량 오픈 소스 모바일 장치(휴대폰) 감지입니다. 모바일 장치 환경을 감지하기 위해 HTTP 헤더와 결합된 User-Agent의 문자열을 사용하는 PHP 클래스입니다. 이 장치 감지 PHP 클래스 라이브러리의 가장 강력한 점은 사용된 장치 유형(작업 유형, 휴대폰 브랜드 등 포함)과 브라우저 세부 정보를 감지할 수 있는 매우 완벽한 라이브러리를 가지고 있다는 것입니다.

http://mobileDetect.net/

//使用实例
 
include 'Mobile_Detect.php';
$detect = new Mobile_Detect();
 
// Check for any mobile device.
if ($detect->isMobile())
 
// Check for any tablet.
if($detect->isTablet())
 
// Check for any mobile device, excluding tablets.
if ($detect->isMobile() && !$detect->isTablet())
 
if ($detect->isMobile() && !$detect->isTablet())
 
// Alternative to $detect->isAndroidOS()
$detect->is('AndroidOS');
  
// Batch usage
foreach($userAgents as $userAgent){
  $detect->setUserAgent($userAgent);
  $isMobile = $detect->isMobile();
}
  
// Version check.
$detect->version('iPad'); // 4.3 (float)
로그인 후 복사

출처: http://www.oschina.net/code/snippet_118180_16788

위 내용은 관련 내용을 포함하여 모바일 기기(휴대폰) 감지를 위한 PHP 클래스 라이브러리를 소개한 내용으로, PHP 튜토리얼에 관심이 있는 친구들에게 도움이 되기를 바랍니다.

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!