//分析返回用户网页浏览器名称,返回的数组第一个为浏览器名称,第二个是版本号。

 function getBrowser() {
     $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及以下的,就跳转页面
 function check_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:获取浏览器的版本信息的更多相关文章

  1. 使用JavaScript获取浏览器Chrome版本信息

    Navigator对象包含了有关浏览器的信息 可通过访问其属性appVersion或userAgent来获取浏览器Chrome版本 例如,我所使用的QQ浏览器的appVersion和userAgent ...

  2. 获取 Android APP 版本信息工具类(转载)

    获取 Android APP 版本信息工具类 获取手机APP版本信息工具类 1.获取版本名称 2.获取版本号 3.获取App的名称 package com.mingyue.nanshuibeidiao ...

  3. E1.获取Elixir/Erlang版本信息

    E1.获取Elixir/Erlang版本信息 获取Elixir版本 直接在shel中打开iex (interactive shell),就可以查到具体的版本信息: iex Erlang/OTP 22 ...

  4. 获取浏览器的相关信息(navigator)

    * 智能机浏览器版本信息: * */ var browser = { versions: function() { var u = navigator.userAgent + navigator.ap ...

  5. 获取Exe文件版本信息的函数(使用GetFileVersionInfo得到TFileVersionInfo结构体,包含12项内容)

    Type   TFileVersionInfo   =   Record         FixedInfo:TVSFixedFileInfo;         {版本信息}         Comp ...

  6. js获取浏览器的版本代码

    <script>function GetXmlHttpObject(){var xmlHttp=null;var httptype='';try { // Firefox, Opera 8 ...

  7. ecshop获取浏览器各个版本

    <?php /** * 获得浏览器名称和版本 * * @access public * @return string */ function get_user_browser() { if (e ...

  8. js获取浏览器对象的信息

    js中有一个对象叫 navigator,navigator 对象包含有关浏览器的信息.所有的浏览器都支持该对象. 其中经常用到的是 navigator.userAgent 属性,通常,它是在 navi ...

  9. mfc获取exe的版本信息

    CString GetFileVersion(const CString& sTargetFileName){ DWORD nInfoSize = 0, dwHandle = 0; nInfo ...

随机推荐

  1. UVa 7146 Defeat the Enemy(贪心)

    题目链接: 传送门 Defeat the Enemy Time Limit: 3000MS     Memory Limit: 32768 KB Description Long long ago t ...

  2. CF 445B DZY Loves Chemistry(并查集)

    题目链接: 传送门 DZY Loves Chemistry time limit per test:1 second     memory limit per test:256 megabytes D ...

  3. PHP函数-检查某个值是否存在于数组中

    函数:in_array -- 检查数组中是否存在某个值定义:bool in_array ( mixed needle, array haystack [, bool strict] )在haystac ...

  4. PL/0编译器(java version) – SymbolTable.java

    1: package compiler; 2: //竟然没有对符号表检查大小,会溢出的. 3:   4: import java.io.IOException; 5:   6: public clas ...

  5. js初学—js全自定义单选框

    代码如下: <script type="text/javascript"> window.onload=function() { var oIput=document. ...

  6. Apache+php+mysql+SQLyog在windows7下的安装与配置图解

    先准备好软件: Apache官方下载地址:httpd-2.2.25-win32-x86-openssl-0.9.8y.msi,更多版本在这里: php官方下载地址:php-5.4.37-Win32-V ...

  7. PyCharm光标变粗的解决办法

    pycharm中光标变粗,如下: 此时变成了改写模式,只需要按下键盘的insert键即可

  8. Transmission 设置硬盘缓存

          1.找到settings.json 调置文件.此文件是transmission的配置文件.一般存放在  /home/用户名/.config/transmission 目录下.       ...

  9. Unity时钟定时器插件

    Unity时钟定时器插件 http://dsqiu.iteye.com/blog/2020603https://github.com/joserocha3/KillerCircles/blob/67a ...

  10. Java中hashCode的作用

    转  http://blog.csdn.net/fenglibing/article/details/8905007 Java中hashCode的作用 2013-05-09 13:54 64351人阅 ...