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에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 4727 |
프로프리랜서
|
13년 전 | 931 | |
| 4726 | 13년 전 | 786 | ||
| 4725 |
PHPㅡASP프로그래머
|
13년 전 | 1281 | |
| 4724 |
뭐먹고살지ㅠ
|
13년 전 | 851 | |
| 4723 | 13년 전 | 1577 | ||
| 4722 |
프리랜서클럽
|
13년 전 | 1177 | |
| 4721 | 13년 전 | 783 | ||
| 4720 | 13년 전 | 7267 | ||
| 4719 |
PHPㅡASP프로그래머
|
13년 전 | 791 | |
| 4718 |
DBDBDB
|
13년 전 | 667 | |
| 4717 | 13년 전 | 1901 | ||
| 4716 |
헬프데스크
|
13년 전 | 1783 | |
| 4715 |
Werbershinta
|
13년 전 | 657 | |
| 4714 | 13년 전 | 1310 | ||
| 4713 | 13년 전 | 1044 | ||
| 4712 | 13년 전 | 1148 | ||
| 4711 | 13년 전 | 3111 | ||
| 4710 | 13년 전 | 813 | ||
| 4709 | 13년 전 | 2600 | ||
| 4708 | 13년 전 | 1008 | ||
| 4707 |
PHPㅡASP프로그래머
|
13년 전 | 791 | |
| 4706 |
돗단배123
|
13년 전 | 1601 | |
| 4705 |
|
13년 전 | 922 | |
| 4704 | 13년 전 | 761 | ||
| 4703 | 13년 전 | 1455 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기