Mobile_Detect.php切换到桌面

时间:2016-04-05 16:46:58

标签: mobile web mobile-website

我有切换到桌面的问题,我使用Mobile_Detect.php脚本并且检测移动设备工作正常,这里是代码

    inc.header.php (Desktop site)

if ($_GET['v'] == 'desktop') {

   $_SESSION["v1"] = 'desktop';


}
// Detect browser and redirect mobile users unless they've already opted out
if ($_SESSION["v1"] != 'desktop') {
    // Place browser detection and redirection code here
require_once 'Mobile_Detect.php';
$objMobile = new Mobile_Detect;
if($objMobile ->isMobile()) {

if($_SERVER['REQUEST_URI']=="/")
    {

   header('Location: http://www.website.com/m/');
    }
else
    {
 header("Location: http://www.website.com/m".$_SERVER['REQUEST_URI']);
    }
    exit;
}
}

移动设置如下

files :

**inc.footer.php** 

if ($_GET['v'] == 'desktop') {

   $_SESSION["v1"] = 'desktop';


}

**footer.html**

<a href="http://website.com/?v=desktop">Desktop version</a></div>

s interesting switching to desktop is working when I在桌面计算机上浏览的内容,但m trying to switch from mobile it指示我http://website.com/m/?v=desktop但未切换到桌面

您的帮助将不胜感激

由于

0 个答案:

没有答案