【问题标题】:Find out which pages I will be on Mobile [duplicate]找出我将在移动设备上的哪些页面[重复]
【发布时间】:2013-06-25 14:18:20
【问题描述】:

考虑在移动用户愿意建立我的页面的正确时机,应该是他们来到该网站,所以它必须是一个框,询问用户是在右侧还是在移动网站上,只有在您使用手机时才必须这样做,但在时尚方面,如果您使用他的电脑则无法这样做。

如果您认为您必须在移动页面上,那么您将被踢到 m.mobil.com

如果你想保持正常的一面,你只是 mobil.com,

只有安卓、iphone或window手机才会这样做

如果你是他的ipad或者类似ipad的手机就不行了。

【问题讨论】:

    标签: php javascript css


    【解决方案1】:

    由于您使用的是 PHP,我推荐 Mobile_Detect 类。我工作得很好而且很轻松。

    https://code.google.com/p/php-mobile-detect/

    它几乎可以检测任何移动设备。这可能在您的index.php 文件中

    示例用法。

     <?php
            // Include and instantiate the class.
            require_once 'Mobile_Detect.php';
            $detect = new Mobile_Detect;
    
            // Any mobile device (phones or tablets).
            if ( $detect->isMobile() ) {
            //do stuff, redirect or whatever
            }
    
            // Check if an iphone, ipad etc:
            if( $detect->isiOS() ){
            //do stuff, redirect or whatever
            }
            //check if an Android device
            if( $detect->isAndroidOS() ){
            //do stuff, redirect or whatever
            }
    
     ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-07
      • 1970-01-01
      • 1970-01-01
      • 2020-03-29
      相关资源
      最近更新 更多