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;
?>
相關文章
相關標籤/搜索