熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> PHP編程 >> 正文

PHP取得用戶浏覽器和系統函數

2013-11-15 12:33:33  來源: PHP編程 

  //操作系統
function userOS(){
$user_OSagent = $_SERVER[HTTP_USER_AGENT];

if(strpos($user_OSagent"NT ")) {
$visitor_os ="Windows XP (SP)";
} elseif(strpos($user_OSagent"NT ") && strpos($user_OSagent"WOW")){
$visitor_os ="Windows XP bit Edition";
} elseif(strpos($user_OSagent"NT ")) {
$visitor_os ="Windows ";
} elseif(strpos($user_OSagent"NT ")) {
$visitor_os ="Windows Vista";
} elseif(strpos($user_OSagent"NT ")) {
$visitor_os ="Windows ";
} elseif(strpos($user_OSagent"")) {
$visitor_os ="Windows ME";
} elseif(strpos($user_OSagent"NT ")) {
$visitor_os ="Windows NT ";
} elseif(strpos($user_OSagent"")) {
$visitor_os ="Windows ";
} elseif(strpos($user_OSagent"")) {
$visitor_os ="Windows ";
} elseif(strpos($user_OSagent"Mac")) {
$visitor_os ="Mac";
} elseif(strpos($user_OSagent"Linux")) {
$visitor_os ="Linux";
} elseif(strpos($user_OSagent"Unix")) {
$visitor_os ="Unix";
} elseif(strpos($user_OSagent"FreeBSD")) {
$visitor_os ="FreeBSD";
} elseif(strpos($user_OSagent"SunOS")) {
$visitor_os ="SunOS";
} elseif(strpos($user_OSagent"BeOS")) {
$visitor_os ="BeOS";
} elseif(strpos($user_OSagent"OS/")) {
$visitor_os ="OS/";
} elseif(strpos($user_OSagent"PC")) {
$visitor_os ="Macintosh";
} elseif(strpos($user_OSagent"AIX")) {
$visitor_os ="AIX";
} elseif(strpos($user_OSagent"IBM OS/")) {
$visitor_os ="IBM OS/";
} elseif(strpos($user_OSagent"BSD")) {
$visitor_os ="BSD";
} elseif(strpos($user_OSagent"NetBSD")) {
$visitor_os ="NetBSD";
} else {
$visitor_os ="其它";
}
return $visitor_os;
}
 

//浏覽器設置
function userBrowser(){
$user_OSagent = $_SERVER[HTTP_USER_AGENT];
if(strpos($user_OSagent"Maxthon") && strpos($user_OSagent"MSIE")) {
$visitor_browser ="Maxthon(Microsoft IE)";
}elseif(strpos($user_OSagent"Maxthon ")) {
$visitor_browser ="Maxthon ";
}elseif(strpos($user_OSagent"Maxthon")) {
$visitor_browser ="Maxthon";
}elseif(strpos($user_OSagent"MSIE ")) {
$visitor_browser ="MSIE ";
}elseif(strpos($user_OSagent"MSIE ")) {
$visitor_browser ="MSIE ";
} elseif(strpos($user_OSagent"MSIE ")) {
$visitor_browser ="MSIE ";
} elseif(strpos($user_OSagent"MSIE ")) {
$visitor_browser ="MSIE ";
} elseif(strpos($user_OSagent"MSIE ")) {
$visitor_browser ="MSIE ";
} elseif(strpos($user_OSagent"NetCaptor")) {
$visitor_browser ="NetCaptor";
} elseif(strpos($user_OSagent"Netscape")) {
$visitor_browser ="Netscape";
} elseif(strpos($user_OSagent"Lynx")) {
$visitor_browser ="Lynx";
} elseif(strpos($user_OSagent"Opera")) {
$visitor_browser ="Opera";
} elseif(strpos($user_OSagent"Konqueror")) {
$visitor_browser ="Konqueror";
} elseif(strpos($user_OSagent"Mozilla/")) {
$visitor_browser ="Mozilla";
} elseif(strpos($user_OSagent"U")) {
$visitor_browser ="Firefox";
} else {
$visitor_browser ="其它";
}
return $visitor_browser;
}

  $out_ieos ="您的操作系統以及浏覽器信息"userOS()" "userBrowser();


  echo $out_ieos;


From:http://tw.wingwit.com/Article/program/PHP/201311/21172.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.