php判断浏览器和操作系统,php判断操作系统或浏览器

function userOS($user_OSagent=''){

if(strpos($user_OSagent,"NT 6.1")) {

$visitor_os = "Windows7";

}elseif(preg_match('/NT 5.1/',$user_OSagent)){

$visitor_os = "Windows XP (SP2)";

}elseif(strpos($user_OSagent,"Windows XP")) {

$visitor_os = "Windows XP";

}elseif(strpos($user_OSagent,"NT 5.2") && strpos($user_OSagent,"WOW64")){

$visitor_os = "Windows XP 64-bit Edition";

}elseif(strpos($user_OSagent,"NT 5.2")) {

$visitor_os = "Windows 2003";

}elseif(strpos($user_OSagent,"NT 6.0")) {

$visitor_os = "Windows Vista";

}elseif(strpos($user_OSagent,"NT 5.0")) {

$visitor_os = "Windows 2000";

}elseif(strpos($user_OSagent,"4.9")) {

$visitor_os = "Windows ME";

}elseif(strpos($user_OSagent,"NT 4")) {

$visitor_os = "Windows NT 4.0";

}elseif(strpos($user_OSagent,"98")) {

$visitor_os = "Windows 98";

}elseif(strpos($user_OSagent,"95")) {

$visitor_os = "Windows 95";

}elseif(strpos($user_OSagent,"NT 9.0")) {

$visitor_os = "Windows NT 9.0";

}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/2")) {

$visitor_os = "OS/2";

}elseif(strpos($user_OSagent,"PC")) {

$visitor_os = "Macintosh";

}elseif(strpos($user_OSagent,"AIX")) {

$visitor_os = "AIX";

}elseif(strpos($user_OSagent,"IBM OS/2")) {

$visitor_os = "IBM OS/2";

}elseif(strpos($user_OSagent,"BSD")) {

$visitor_os = "BSD";

}elseif(strpos($user_OSagent,"NetBSD")) {

$visitor_os = "NetBSD";

}elseif(preg_match('/Apple/i',$user_OSagent)) {

$visitor_os = "Applepc";

}elseif(strpos($user_OSagent,"NT 6.1")) {

$visitor_os = "Windows7";

}elseif(preg_match('/Opera/i',$user_OSagent)) {

$visitor_os = "Opera";

}elseif(preg_match('/Nokia/i', $user_OSagent)) {

$visitor_os = "nokia";

}elseif(preg_match('/OPPO/i', $user_OSagent)) {

$visitor_os = "OPPO ";

}elseif(preg_match('/SymbianOS/i', $user_OSagent)) {

$visitor_os = "SymbianOS ";

}elseif(preg_match('/Windows Mobile/i', $user_OSagent)) {

$visitor_os = "Windows Mobile";

}elseif(preg_match('/DoCoMo/i',$user_OSagent)){

$visitor_os = "DoCoMo";

}elseif(strpos($user_OSagent,"Red Hat")) {

$visitor_os = "linux";

}elseif(preg_match('/SonyEricsson/i',$user_OSagent)) {

$visitor_os = "SonyEricsson";

}elseif(preg_match('/Lynx/i',$user_OSagent)) {

$visitor_os = "Lynx";

}elseif(preg_match('/ucweb|MQQBrowser|J2ME|IUC|3GW100|LG-MMS|i60|Motorola|MAUI|m9|ME860|maui|C8500|gt|k-touch|X8|htc|GT-S5660|UNTRUSTED|SCH|tianyu|lenovo|SAMSUNG/i',$user_OSagent)) {

$visitor_os = "mobile";

}else{

$visitor_os =$user_OSagent;

}

return $visitor_os;

}

function userBrowser($user_OSagent){

if(strpos($user_OSagent,"Maxthon") && strpos($user_OSagent,"MSIE")) {

$visitor_browser ="Maxthon(Microsoft IE)";

}elseif(strpos($user_OSagent,"Maxthon 2.0")) {

$visitor_browser ="Maxthon 2.0";

}elseif(strpos($user_OSagent,"Maxthon")) {

$visitor_browser ="Maxthon";

}elseif(strpos($user_OSagent,"MSIE 7.0")) {

$visitor_browser ="IE7";

}elseif(strpos($user_OSagent,"MSIE 6.0")) {

$visitor_browser ="IE6";

}elseif(strpos($user_OSagent,"MSIE 5.5")) {

$visitor_browser ="IE5";

}elseif(strpos($user_OSagent,"MSIE 5.0")) {

$visitor_browser ="IE5";

}elseif(strpos($user_OSagent,"MSIE 4.01")) {

$visitor_browser ="IE4";

}elseif(strpos($user_OSagent,"MSIE 8.0")) {

$visitor_browser ="IE8";

}elseif(strpos($user_OSagent,"MSIE 9.0")) {

$visitor_browser ="IE9";

}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/5.0")) {

$visitor_browser ="Mozilla";

}elseif(preg_match('/ucweb/i', $user_OSagent)) {

$visitor_browser ="ucweb";

}elseif(preg_match('/Opera/i', $user_OSagent)) {

$visitor_browser ="Opera";

}elseif(preg_match('/SonyEricsson/i', $user_OSagent)) {

$visitor_browser ="SonyEricsson";

}elseif(preg_match('/Apple/i',$user_OSagent)) {

$visitor_browser ="Apple";

}elseif(preg_match('/OPPO/i',$user_OSagent)) {

$visitor_browser ="OPPO";

}elseif(strpos($user_OSagent,"i60")) {

$visitor_browser ="lenovo i60";

}elseif(preg_match('/Nokia/i', $user_OSagent)) {

$visitor_browser ="nokia";

}elseif(strpos($user_OSagent,"LG-MMS")) {

$visitor_browser ="LG-BROWSER";

}elseif(strpos($user_OSagent,"SMIT-BROWSER")) {

$visitor_browser ="SMIT-BROWSER";

}elseif(preg_match('/zet/i', $user_OSagent)) {

$visitor_browser ='ZET-BROWSER';

}elseif(preg_match('/Lynx/i', $user_OSagent)) {

$visitor_browser ='Lynx';

}elseif(strpos($user_OSagent,"Firefox")) {

$visitor_browser ="Firefox";

}elseif(strpos($user_OSagent,"U")) {

$visitor_browser ="Firefox";

}else {

$visitor_browser ="$user_OSagent";

}

return $visitor_browser;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值