【问题标题】:How to detect if it is a desktop device using the DeviceDetector php library? [closed]如何使用 DeviceDetector php 库检测它是否是桌面设备? [关闭]
【发布时间】:2018-07-05 03:51:30
【问题描述】:

我正在使用这个库从 http 用户代理字符串中检测设备和客户端程序。

Device Detector

在图书馆的demo page 上,即使未检测到设备型号,他们也能够区分设备是台式机还是智能手机。但是,他们没有文件来说明他们使用什么功能来做到这一点。在 github 上阅读我,我猜是$dd->getDevice(),但似乎该函数只返回一个整数 1 或 0(我不知道它是什么意思)

他们没有提供演示页面的源代码,除了自述页面之外没有其他文档。任何人都知道他们在演示页面上使用什么功能来检测是智能手机还是台式机?

【问题讨论】:

  • 可能当$dd->isDesktop()返回true时
  • 您能否将其作为答案,以便我将其标记为正确?你在哪里找到这个功能的?似乎在自述文件中没有提到它
  • 我已经添加了答案,我在代码中找到了。

标签: php user-agent device-detection


【解决方案1】:

在文件DeviceDetector.php中有一个函数isDesktop(),语句如下

/**
 * Returns if the parsed UA was identified as desktop device
 * Desktop devices are all devices with an unknown type that are running a desktop os
 *
 * @see self::$desktopOsArray
 *
 * @return bool
 */
public function isDesktop()

【讨论】:

    猜你喜欢
    • 2016-02-04
    • 2013-05-21
    • 1970-01-01
    • 1970-01-01
    • 2015-03-20
    • 2015-11-11
    • 1970-01-01
    • 2015-07-19
    • 1970-01-01
    相关资源
    最近更新 更多