//Detect special conditions devices

$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); $iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); if(stripos($_SERVER['HTTP_USER_AGENT'],"Android") && stripos($_SERVER['HTTP_USER_AGENT'],"mobile")){ $Android = true; }else if(stripos($_SERVER['HTTP_USER_AGENT'],"Android")){ $Android = false; $AndroidTablet = true; }else{ $Android = false; $AndroidTablet = false; } $webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS"); $BlackBerry = stripos($_SERVER['HTTP_USER_AGENT'],"BlackBerry"); $RimTablet= stripos($_SERVER['HTTP_USER_AGENT'],"RIM Tablet"); //do something with this information if( $iPod || $iPhone ){ //were an iPhone/iPod touch -- do something here }else if($iPad){ //were an iPad -- do something here }else if($Android){ //we're an Android Phone -- do something here }else if($AndroidTablet){ //we're an Android Phone -- do something here }else if($webOS){ //we're a webOS device -- do something here }else if($BlackBerry){ //we're a BlackBerry phone -- do something here }else if($RimTablet){ //we're a RIM/BlackBerry Tablet -- do something here }else{ //we're not a mobile device. }


http://www.schiffner.com/programming-php-classes/php-mobile-device-detection/

'php' 카테고리의 다른 글

PHP 홀수 짝수 구분  (0) 2012.09.21
모바일 접속시 모바일 페이지로 이동  (0) 2012.08.21
php 환경 변수  (0) 2012.08.15
strip_tags 오늘 왜케 이뿌지...  (0) 2012.06.26
Windows PHP gd 설정  (0) 2012.06.08

+ Recent posts