下面这个是能判断的,但是出现一个问题,就是ios版本的UC浏览器出现了一个极速模式,切换到了极速模式就判断不出来了。现在想单独判断UC浏览器下进行跳转。
复制代码
- $userAgent = $_SERVER['HTTP_USER_AGENT'];
- if(strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod")){
- header("location:http://www.baidu.com");
- }else if(strpos($userAgent,"Android")){
- header("location:http://www.google.com");
- }
- 解决了 原来在UC里面没有iPhone\iPad\iPod相关字样,加一个复制代码
- strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod")
- 改成
复制代码
- strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod") || strpos($userAgent,"iOS")
- 就可以了