how to detect internet explorer and firefox using PHP?

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

how to detect internet explorer and firefox using PHP?

6条回答
  •  天命终不由人
    2021-01-29 09:09

    So that's not what you asked for. But it's often more senseful to differentiate on features:

     if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
          // Firefox, Safari, Opera, Chrome, IE9
     }
     else {
          // IE5,IE6,IE7,IE8
     }
    

    None of the garbage versions of IE supports XHTML for example. So that's a good way to separate browsers. Note how IE9 however counts into the newer class, and might actually be treated comparable to Firefox.

提交回复
热议问题