“VIEW FULL SITE” mobile site option

前端 未结 5 1708
别跟我提以往
别跟我提以往 2020-12-15 01:41

So I\'m working on the mobile version of a site I\'m doing, and so far, I\'m pulling the mobile sites content from its main counterpart, the main site.

As I study s

5条回答
  •  轮回少年
    2020-12-15 02:33

    First, go to the following URL and download the mobile_detect.php file:

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

    Next, follow the instructions on the page, and upload the mobile_detect.php to your root directory, Insert the following code on your index or home page:

        isMobile() && isset($_COOKIE['mobile']))
        {
        $detect = "false";
        }
        elseif ($detect->isMobile())
        {
        header("Location:http://www.yourmobiledirectory.com");
        }
        ?>
    

    You will notice that the above code is checking for a cookie called "mobile", this cookie is set when the mobile device is redirected to the mobile page. To set the cookie insert the following code on your mobile landing page:

        
    

    View the full article at: http://www.squidoo.com/php-mobile-redirect

提交回复
热议问题