命令失败的设备跟踪

时间:2015-09-03 13:20:26

标签: javascript php

我正在尝试使用此处mobiledetect.net找到的库来使用操作系统检测代码。但我不知道为什么命令一直失败。如果用户来自Android操作系统,那么此代码的工作方式就是$os = 'android'函数。但是使用此代码,我们无法检测任何内容,用户也会自动检测桌面。在此代码的最后一部分中提到了证明代码失败的结果,最后,用户只检测桌面。不知怎的,我的编码中有一些错误?你能帮我们查一下吗?

 if( $detect->isMobile() )  {

    if( $detect->isAndroidOS() ) {
        $os = 'android';
    }

    if( $detect->isiOS() ){
        $os = 'iphone';
    }

    if( $detect->isBlackBerryOS() ){
        $os = 'blackberry';
    }

    if( $detect->isPalmOS() ){
        $os = 'palmos';
    }

    if( $detect->isiOS() ){
        $os = 'ipad';
    }

    if( $detect->isBlackBerryOS() ){
        $os = 'blackberry_playbook';
    }

    if( $detect->isWindowsMobileOS() ){
        $os = 'windows_mobile';
    } else
        $os = 'wap';

} else
$os = 'desktop';

return $os;

0 个答案:

没有答案