how to detect internet explorer and firefox using PHP?

前端 未结 6 686
傲寒
傲寒 2021-01-29 09:05

how to detect internet explorer and firefox using PHP?

6条回答
  •  孤街浪徒
    2021-01-29 09:22

     if (isset($_SERVER['HTTP_USER_AGENT'])) {
       $useragent   = $_SERVER['HTTP_USER_AGENT'];
     }
    
     if (strlen(strstr($useragent  , 'MSIE')) > 0) {
        $browser = 'internet explorer';
     }else if (strlen(strstr($useragent  , 'Firefox')) > 0) {
        $browser = 'firefox';
     }else{
       $browser = 'others';
     }
    
     echo $browser;
    

提交回复
热议问题