function getBrowser($agent) {
$browser = array(
"MSIE 5.0" => "/msie 5.0[0-9]*/",
"MSIE 5.5" => "/msie 5.5[0-9]*/",
"MSIE 6.0" => "/msie 6.0[0-9]*/",
"MSIE 7.0" => "/msie 7.0[0-9]*/",
"MSIE 8.0" => "/msie 8.0[0-9]*/",
"MSIE 9.0" => "/msie 9.0[0-9]*/",
"Chrome" => "/chrome\/*/",
"FireFox" => "/firefox\/*/",
"Netscape" => "/x11/",
"Opera" => "/opera*/",
"Safari" => "/safari\/*/",
"Android" => "/android/",
"Mobile Safari" => "/mobile\/[0-9a-z]* safari/",
"Robot" => "/yahoo/",
"Robot" => "/bot/"
);
$agent = strtolower($agent);
foreach($browser as $name=>$exp){
if(preg_match($exp, $agent)){
$browser = $name;
}
}
return $browser;
}
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$browser = getBrowser($u_agent);
if($browser == 'Android' || $browser == 'Mobile Safari'){
if($browser == 'Android'){
ECHO "ANDROID";
}else{
ECHO "IPHONE";
}
}else{
ECHO "OTHER";
}
댓글 6개
게시판 목록
팁게시판
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5027 | 12년 전 | 3012 | ||
| 5026 | 12년 전 | 2685 | ||
| 5025 | 12년 전 | 3294 | ||
| 5024 | 12년 전 | 1015 | ||
| 5023 | 12년 전 | 839 | ||
| 5022 | 12년 전 | 2011 | ||
| 5021 | 12년 전 | 1505 | ||
| 5020 | 12년 전 | 1103 | ||
| 5019 | 12년 전 | 2094 | ||
| 5018 |
프로프리랜서
|
12년 전 | 1317 | |
| 5017 |
프로프리랜서
|
12년 전 | 786 | |
| 5016 |
프로프리랜서
|
12년 전 | 1320 | |
| 5015 |
프로프리랜서
|
12년 전 | 829 | |
| 5014 |
프로프리랜서
|
12년 전 | 1210 | |
| 5013 | 12년 전 | 3755 | ||
| 5012 | 12년 전 | 3933 | ||
| 5011 | 12년 전 | 1359 | ||
| 5010 | 12년 전 | 3838 | ||
| 5009 | 12년 전 | 2517 | ||
| 5008 | 12년 전 | 2227 | ||
| 5007 |
|
12년 전 | 1268 | |
| 5006 | 12년 전 | 1634 | ||
| 5005 | 12년 전 | 5153 | ||
| 5004 | 12년 전 | 1473 | ||
| 5003 |
|
12년 전 | 2087 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기