<h1>获得用户客户端浏览器信息</h1> <span style="color:#B03060;font-size:22px;font-weight:800">代码如下:</span> ~~~ /** * 获得用户客户端浏览器信息 */ function browserinformation ($agent) { $os = false; if (preg_match('/MSIE8.0/i', $agent)) { $os = 'IE8.0'; } else if (preg_match('/MSIE6.0/i', $agent)) { $os = 'IE6.0'; } else if (preg_match('/Firefox\/17/i', $agent)) { $os = 'Firefox17'; } else if (preg_match('/Firefox\/16/i', $agent)) { $os = 'Firefox16'; } else if (preg_match('/Chrome/i', $agent)) { $os = 'Chrome'; } else if (preg_match('/Safari/i', $agent)) { $os = 'Safari'; }else if(preg_match('/Opera/i', $agent)) { $os = 'Opera'; }else { $os = '未知浏览器'; } return $os; } ~~~