我正在尝试检测 iPad 和 iPhone 用户何时使用 iOS6 之前的 iOS 版本,并向他们显示他们需要升级到 iOS6 才能获得特定功能的消息。
我认为下面的代码可以工作,但我使用的是带有 iOS 6.0.0 的 iPad,但我仍然进入黑色代码以显示升级消息。
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android= stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$webOS= stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
//do something with this information
if( $iPad || $iPhone &&
(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone OS 6_0') == false &&
strpos($_SERVER['HTTP_USER_AGENT'], 'OS 6_0') == false)){
//some code to let user know this feature is not available for older versions of ios
}