来源 php.net 官网评论截取
-- Declan kelly
Please note that Internet Explorer 11 no longer contains MSIE in its user agent string, for example on Windows 8 with IE11 I get the following:
Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
So if you want to include a test for IE11, the code above changes to:
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE ||
strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== FALSE) {
echo 'You are using Internet Explorer.<br />';
}
?>
-- Bilal.S
On Edge, the user agent string does not contain 'MSIE' neither 'Trident', but rather 'Edge'.
建议使用者亲测,我自测结果和上述有点不一样,因为WIN7电脑不能安装EDGE,所以我是用调试平台调试的,具体情形需浏览人员自行甄别