php - 如何在PHP中检测手机和平板电脑

标签 php html mobile tablet responsive-design

我在这个线程上读到: Simplest way to detect a mobile device 关于如何知道浏览器是否是移动设备。一般代码是这样的:

<?php include("Mobile_Detect.php"); include("demoData.php");
$detectIsMobile = new Mobile_Detect(); ?>

问题是我想治疗平板电脑(iPad 和 xoom)。

我看到那里有一个我已经测试过的 isIpad() 函数 - 但仍然没有解决平板电脑和手机之间的区别。

有什么想法吗?

谢谢, 阿隆

最佳答案

使用

<?php
    if($detect->isTablet()){
        // any tablet
    }
?>

您可以引用此页面了解更多信息http://code.google.com/p/php-mobile-detect/

关于php - 如何在PHP中检测手机和平板电脑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8328448/

相关文章:

php - 在 PHP 中跨类共享类实例

php - 我应该在 PHP 中允许 'allow_url_fopen' 吗?

javascript - 从选择中删除选项并重新附加选定的更改

HTML/CSS : How to write a text vertically, 保持字符水平

css - 智能手机和平板电脑最常用的媒体查询?

html - 移动像素与桌面像素不同?

php - IE 不允许用户通过 PHP 上传 jpg - 其他图像扩展有效

php - Zend 工具创建操作无法识别模块中的 Controller

html - HTML 文档或 CSS 树的深度是否有限制?

java - 手机端口0接收短信