mobile device detection

PHP RSS Icon ATOM Icon 2012/01/27 18:02 visualp
[원문]- http://www.schiffner.com/index.php/programming-php-classes/php-mobile-device-detection/

//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){ //were an Android Phone -- do something here }else if($AndroidTablet){ //were an Android Phone -- do something here }else if($webOS){ //were a webOS device -- do something here }else if($BlackBerry){ //were a BlackBerry phone -- do something here }else if($RimTablet){ //were a RIM/BlackBerry Tablet -- do something here }
이올린에 북마크하기(0) 이올린에 추천하기(0)
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://blog.visualp.com/rss/response/449

댓글+트랙백 ATOM :: http://blog.visualp.com/atom/response/449

트랙백 주소 :: http://blog.visualp.com/trackback/449

트랙백 RSS :: http://blog.visualp.com/rss/trackback/449

트랙백 ATOM :: http://blog.visualp.com/atom/trackback/449