【发布时间】:2015-07-29 05:06:00
【问题描述】:
我正在尝试使用此脚本http://mobiledetect.net/ 检测设备
但它没有检测到 iPhone。
header.php:
<?php
require_once 'include/Mobile_Detect.php';
$detect = new Mobile_Detect; ?>
device.php:
<?php include 'include/header.php'; ?>
<?php if( $detect->isMobile() && $detect->isTablet() ){ ?>
<script type='text/javascript'>
alert("I am mobile");
</script>
<?php } else { ?>
<script type='text/javascript'>
alert("I am desktop");
</script>
<? } ?>
当我检查桌面上的页面时,我会弹出以下消息:I am desktop - 正如我所料
当我在 android 平板电脑上查看页面时,我会弹出以下消息:I am mobile - 正如我所料
当我在 iPhone 上查看页面时,我会弹出以下消息:I am desktop - 不符合预期。
这是为什么?
这里是PAGE
【问题讨论】:
标签: php android ios iphone mobile-devices