php:PHP获取浏览器的版本信息
2013-01-11 11:42
501 查看
PHP语言: PHP获取浏览器的版本信息
//分析返回用户网页浏览器名称,返回的数组第一个为浏览器名称,第二个是版本号。 functiongetBrowser() { $sys = $_SERVER['HTTP_USER_AGENT']; if (stripos($sys, "NetCaptor") >0) { $exp[0] ="NetCaptor"; $exp[1] =""; } elseif (stripos($sys, "Firefox/")> 0) { preg_match("/Firefox\/([^;)]+)+/i", $sys,$b); $exp[0] ="Mozilla Firefox"; $exp[1] =$b[1]; } elseif (stripos($sys, "MAXTHON")> 0) { preg_match("/MAXTHON\s+([^;)]+)+/i", $sys,$b); preg_match("/MSIE\s+([^;)]+)+/i", $sys,$ie); // $exp =$b[0]." (IE".$ie[1].")"; $exp[0] =$b[0] . " (IE" . $ie[1] . ")"; $exp[1] =$ie[1]; } elseif (stripos($sys, "MSIE") >0) { preg_match("/MSIE\s+([^;)]+)+/i", $sys,$ie); //$exp ="Internet Explorer ".$ie[1]; $exp[0] ="Internet Explorer"; $exp[1] =$ie[1]; } elseif (stripos($sys, "Netscape")> 0) { $exp[0] ="Netscape"; $exp[1] =""; } elseif (stripos($sys, "Opera") >0) { $exp[0] ="Opera"; $exp[1] =""; } elseif (stripos($sys, "Chrome")> 0) { $exp[0] ="Chrome"; $exp[1] =""; } else { $exp ="未知浏览器"; $exp[1] =""; } return $exp; } //检测浏览器,如果为IE6及以下的,就跳转页面 functioncheck_browser(){ $ie_array = getBrowser(); if($ie_array[0]=='Internet Explorer'&& $ie_array[1] <=6){ include'./template/default/common/show_ie_out.htm'; //header("Location:./template/default/common/show_ie_out.htm"); exit(); } }
相关文章推荐
- php:获取浏览器的版本信息
- js智能获取浏览器版本UA信息的方法
- Javascript获取浏览器版本、支持等信息
- ASP.NET获取客户端的操作系统、浏览器、.NET版本等信息(图)
- PHP 手机浏览器访问网站获取手机相关信息方法集锦
- Asp.Net获取电脑名,IP地址及当前用户名,操作系统,浏览器,.NET版本等信息的方法
- php 获取客户端的ip、地理信息、浏览器信息、本地真实ip
- php获取浏览器信息。获取访客语言。获取访客操作系统。获取访客IP地址。获取访客地理位置。
- 【转载】JS获取浏览器版本信息
- Js 获取、判断浏览器版本信息的简单方法
- PHP如何获取浏览器信息
- PHP获取当前服务器版本,Ip等详细信息
- PHP获取访客IP、地区位置信息、浏览器、来源页面
- [f]智能获取浏览器版本UA信息的方法
- JS获取浏览器flash player版本信息
- js get browser vertion (js获取浏览器信息版本)
- PHP获取客户端IP地址、浏览器类型版本、操作系统
- JavaScript获取浏览器名称、版本等信息
- ASP.NET获取客户端的操作系统、浏览器、.NET版本等信息(图)
- 各种浏览器下用JS获取文件域的文件路径的方法/PHP获取用户浏览器和操作系统版本名称