检测低于iOS 8 php的iOS版本 [英] Detect iOS version lower than iOS 8 php

查看:29
本文介绍了检测低于iOS 8 php的iOS版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果已经搜索了一段时间但没有找到任何好的解决方案.我需要检测 iOS 版本,以便我可以决定是否显示网站的某些部分.此外,此内容应显示在任何非 MobileSafari 浏览器上.

If been searching for a while but don't find any good solution. I need to detect the iOS version so that I can decide whether to show some part of the website or not. Additionally this content should be shown on any non MobileSafari browser.

所以基本上:如果 iOS 并且版本

So basically: If iOS and if version < iOS 8 than do nothing; Else show content

推荐答案

非常感谢@Lucas1 和@Daan 我想出了这个:)

With lots of thanks to @Lucas1 and @Daan I came up with this :)

<?php 
if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'],'iPad' ) || strpos($_SERVER['HTTP_USER_AGENT'], 'iPod' ) !== false){
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'OS 8_0') !== false) {
    echo "content here on ios";
    }
    else{echo "sorry no content for you";}
    }

else {
    echo "content here";
}?>

这篇关于检测低于iOS 8 php的iOS版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆