php中判断iphone版本

引用:http://bbs.php100.com/read-htm-tid-428301.html

下面这个是能判断的,但是出现一个问题,就是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. strpos($userAgent,"iPhone") || strpos($userAgent,"iPad") || strpos($userAgent,"iPod") || strpos($userAgent,"iOS")


        就可以了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值