如何在PHP上将移动用户重定向到移动样式并返回到原始样式

如何在PHP上将移动用户重定向到移动样式并返回到原始样式,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() ) { } // Any tablet device. if( $detect->isTablet(

我在上使用了这段代码,将用户重定向到移动风格

// Include and instantiate the class.
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;

// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {

}

// Any tablet device.
if( $detect->isTablet() ){

}

// Exclude tablets.
if( $detect->isMobile() && !$detect->isTablet() ){

}

// Check for a specific platform with the help of the magic methods:
if( $detect->isiOS() ){

}

if( $detect->isAndroidOS() ){

}

但是,我想在
mobile style
上放置一个链接或按钮,以将用户返回到
原始样式
,而无需再次自动将他们转到
mobile style
,我是如何做到的?

您可以从链接中传递一个变量,比如
?mob=false
,然后在执行移动检查时在顶部检查它

$mob = true;
if(isset($_GET['mob'])){
    $mob = $_GET['mob'];
}
if ( $detect->isMobile() && mob !== false ) {
   //mobile stuff
}

好的技巧,但没有起作用,链接已经有了一个变量
?styleid=5
,我在我的代码中使用了它
如果($detect->isMobile()&&$\u GET['styleid']!==5)
你可以在url中添加多个$\u GET变量,比如
?var1=xyz&var2=foo&var3=bar
thanx兄弟,它现在工作了,我使用了session
如果($detect->isMobile()和$vbulletin->session->vars['styleid']!==1)
,如果您允许的话,我还有一个问题,我想通过
&styleid=x
?styleid=x
自动删除我认为必须使用
标题('