下面这个是能判断的,但是出现一个问题,就是ios版本的UC浏览器出现了一个极速模式,切换到了极速模式就判断不出来了。现在想单独判断UC浏览器下进行跳转。



复制代码


  1. $userAgent = $_SERVER['HTTP_USER_AGENT'];
  2. if(strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod")){
  3.     header("location:http://www.baidu.com");
  4. }else if(strpos($userAgent,"Android")){
  5.     header("location:http://www.google.com");
  6. }
  1. 解决了 原来在UC里面没有iPhone\iPad\iPod相关字样,加一个复制代码
  1. strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod")
  1. 改成

复制代码

  1. strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod") || strpos($userAgent,"iOS")
  1. 就可以了