Php 允许使用jquery从移动站点切换到完整站点

Php 允许使用jquery从移动站点切换到完整站点,php,redirect,jquery-mobile,Php,Redirect,Jquery Mobile,我在这里做了一些挖掘,但仍然有点不确定如何完成这一点。以下是场景: 我有一个完整的HTML站点,它调用以下PHP代码: <?php require_once('inc/mobile_device_detect.php'); mobile_device_detect(true,true,true,true,true,true,true,'mobile/',false); ?> <!DOCTYPE html> <html lang="en"> &l

我在这里做了一些挖掘,但仍然有点不确定如何完成这一点。以下是场景:

我有一个完整的HTML站点,它调用以下PHP代码:

<?php
    require_once('inc/mobile_device_detect.php');
    mobile_device_detect(true,true,true,true,true,true,true,'mobile/',false);
?>
<!DOCTYPE html>
<html lang="en">
<head>blah blah</head>
etc...

废话
等
mobile_device_detect.php是

因此,当我用手机访问整个网站时,重定向会完美地发生。接下来,在mobile/index.html上,我为那些想要查看完整站点的用户提供了以下重定向代码(我还应该提到,这个移动站点使用jquery mobile):


当我点击这个链接时,我会重新回到移动页面。我知道这是因为重定向脚本再次被触发。我通过使用桌面客户端访问移动站点来测试这一点,重定向实现得非常完美


有什么办法可以解决想要查看“完整站点”的移动用户的问题吗?

您可以在href上附加一个查询参数,如
href=“../index.html?full=true”
在主页中检查完整参数是否不存在

<?php
    if (!isset($_GET['full'])) {
      require_once('inc/mobile_device_detect.php');
      mobile_device_detect(true,true,true,true,true,true,true,'mobile/',false);
    }
?>


您也可以在会话中设置它,并使其成为会话范围内的选择。我发现我可以简单地使用以下命令检查引用域:if(strpos($\u SERVER[HTTP\u REFERER],“domain name.com”)==0{blah blah}
<?php
    if (!isset($_GET['full'])) {
      require_once('inc/mobile_device_detect.php');
      mobile_device_detect(true,true,true,true,true,true,true,'mobile/',false);
    }
?>