Home >Backend Development >PHP Tutorial >HP判断是不是IE8或者ie7或者ie6,如果是的话跳转到一条链接

HP判断是不是IE8或者ie7或者ie6,如果是的话跳转到一条链接

WBOY
WBOYOriginal
2016-06-06 20:13:36987browse

为什么这样写会出错,求解决方法?谢谢
function getBrowser(){

<code>$agent=$_SERVER["HTTP_USER_AGENT"];
if(strpos($agent,'MSIE')!==false || strpos($agent,'rv:8.0')|| strpos($agent,'rv:7.0')|| strpos($agent,'rv:6.0')) //ie判断</code>

header('Location: http://yuyoushan/wp-content/themes/ken2.0/kdzt/bdie/index.html');
?>

回复内容:

为什么这样写会出错,求解决方法?谢谢
function getBrowser(){

<code>$agent=$_SERVER["HTTP_USER_AGENT"];
if(strpos($agent,'MSIE')!==false || strpos($agent,'rv:8.0')|| strpos($agent,'rv:7.0')|| strpos($agent,'rv:6.0')) //ie判断</code>

header('Location: http://yuyoushan/wp-content/themes/ken2.0/kdzt/bdie/index.html');
?>

难道不是你的function 少了右} ?
代码,起码编辑一下,让人看得清
报错了,最好错误信息一并展示

<code class="php">if(strpos($agent,'MSIE')!==false &&( strpos($agent,'rv:8.0')|| strpos($agent,'rv:7.0')|| strpos($agent,'rv:6.0'))) 
// 必须IE并且版本为6,7,8</code>

最好开下错误报告,不然真的要一行行代码过嘛

<code>ini_set("display_errors", 1);
error_reporting(E_ALL^E_NOTICE);</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn