PHP判断浏览器类型:
- <?php
- $agent = $_SERVER['HTTP_USER_AGENT'];
- if(strpos($agent,"MSIE 8.0"))
- echo "Internet Explorer 8.0";
- else if(strpos($agent,"MSIE 7.0"))
- echo "Internet Explorer 7.0";
- else if(strpos($agent,"MSIE 6.0"))
- echo "Internet Explorer 6.0";
- else if(strpos($agent,"Firefox/3"))
- echo "Firefox 3";
- else if(strpos($agent,"Firefox/2"))
- echo "Firefox 2";
- else if(strpos($agent,"Chrome"))
- echo "Google Chrome";
- else if(strpos($agent,"Safari"))
- echo "Safari";
- else if(strpos($agent,"Opera"))
- echo "Opera";
- else
- echo $agent;
- ?>
本文转自许琴 51CTO博客,原文链接:http://blog.51cto.com/xuqin/914813,如需转载请自行联系原作者