如何php判断浏览器模式,如果是IE模式就提示文字不继续进行,如果是高速模式就不判断 10
9个回答
展开全部
这个不是php做的事情,这个应该是js做的事情,php当然也可以获取到浏览器信息,但是没必要这么做。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
//获取浏览器信息
function getbrowse()
{
$agent = $_server['http_user_agent'];
$browser = '';
$browserver = '';
$browser = array('lynx', 'mosaic', 'aol', 'opera', 'java', 'macweb', 'webexplorer', 'omniweb');
for($i = 0; $i <= 7; $i ++){
if(strpos($agent, $browsers[$i])){
$browser = $browsers[$i];
$browserver = '';
}
}
if(ereg('mozilla', $agent) && !ereg('msie', $agent)){
$temp = explode('(', $agent);
$part = $temp[0];
$temp = explode('/', $part);
$browserver = $temp[1];
$temp = explode(' ', $browserver);
$browserver = $temp[0];
$browserver = preg_replace('/([d.]+)/', '\1', $browserver);
$browserver = $browserver;
$browser = 'netscape navigator';
}
if(ereg('mozilla', $agent) && ereg('opera', $agent)) {
$temp = explode('(', $agent);
$part = $temp[1];
$temp = explode(')', $part);
$browserver = $temp[1];
$temp = explode(' ', $browserver);
$browserver = $temp[2];
$browserver = preg_replace('/([d.]+)/', '\1', $browserver);
$browserver = $browserver;
$browser = 'opera';
}
if(ereg('mozilla', $agent) && ereg('msie', $agent)){
$temp = explode('(', $agent);
$part = $temp[1];
$temp = explode(';', $part);
$part = $temp[1];
$temp = explode(' ', $part);
$browserver = $temp[2];
$browserver = preg_replace('/([d.]+)/','\1',$browserver);
$browserver = $browserver;
$browser = 'internet explorer';
}
if($browser != ''){
$browseinfo = $browser.' '.$browserver;
} else {
$browseinfo = false;
}
return $browseinfo;
}
//应用
$browse = getbrowse();
if($browse == '' ){
}else{
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<?php
if(strpos($_SERVER["HTTP_USER_AGENT"],”MSIE 8.0″))
echo “Internet Explorer 8.0″; //这里可以写其他的执行命令
else if(strpos($_SERVER["HTTP_USER_AGENT"],”MSIE 7.0″))
echo “Internet Explorer 7.0″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”MSIE 6.0″))
echo “Internet Explorer 6.0″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Firefox/3″))
echo “Firefox 3″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Firefox/2″))
echo “Firefox 2″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Chrome”))
echo “Google Chrome”;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Safari”))
echo “Safari”;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Opera”))
echo “Opera”;
else echo $_SERVER["HTTP_USER_AGENT"];
?>
if(strpos($_SERVER["HTTP_USER_AGENT"],”MSIE 8.0″))
echo “Internet Explorer 8.0″; //这里可以写其他的执行命令
else if(strpos($_SERVER["HTTP_USER_AGENT"],”MSIE 7.0″))
echo “Internet Explorer 7.0″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”MSIE 6.0″))
echo “Internet Explorer 6.0″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Firefox/3″))
echo “Firefox 3″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Firefox/2″))
echo “Firefox 2″;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Chrome”))
echo “Google Chrome”;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Safari”))
echo “Safari”;
else if(strpos($_SERVER["HTTP_USER_AGENT"],”Opera”))
echo “Opera”;
else echo $_SERVER["HTTP_USER_AGENT"];
?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<?php
2 if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 8.0″))
3 echo "Internet Explorer 8.0″;
4 else if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 7.0″))
5 echo "Internet Explorer 7.0″;
6 else if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 6.0″))
7 echo "Internet Explorer 6.0″;
8 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Firefox/3″))
9 echo "Firefox 3″;
10 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Firefox/2″))
11 echo "Firefox 2″;
12 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Chrome"))
13 echo "Google Chrome";
14 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Safari"))
15 echo "Safari";
16 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Opera"))
17 echo "Opera";
18 else echo $_SERVER["HTTP_USER_AGENT"];
19 ?>
2 if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 8.0″))
3 echo "Internet Explorer 8.0″;
4 else if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 7.0″))
5 echo "Internet Explorer 7.0″;
6 else if(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 6.0″))
7 echo "Internet Explorer 6.0″;
8 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Firefox/3″))
9 echo "Firefox 3″;
10 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Firefox/2″))
11 echo "Firefox 2″;
12 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Chrome"))
13 echo "Google Chrome";
14 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Safari"))
15 echo "Safari";
16 else if(strpos($_SERVER["HTTP_USER_AGENT"],"Opera"))
17 echo "Opera";
18 else echo $_SERVER["HTTP_USER_AGENT"];
19 ?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询