找出我将在移动设备上的哪些页面[重复]
Posted
技术标签:
【中文标题】找出我将在移动设备上的哪些页面[重复]【英文标题】: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的手机就不行了。
【问题讨论】:
【参考方案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
?>
【讨论】:
以上是关于找出我将在移动设备上的哪些页面[重复]的主要内容,如果未能解决你的问题,请参考以下文章