我面臨一個小小的挑戰。我有一個網站,也是移動版本。當用戶使用手機點擊另一個網站(例如Facebook)的鏈接時,我希望用戶被重定向到顯示所選鏈接內容的移動網站。將選定的桌面網頁鏈接重定向到移動網站從手機
成就:
我能夠從桌面版本的用戶重定向到移動網頁。
挑戰
我無法顯示選定的鏈接e.g http://passnownow.com/inblog.php?id=3840#.UToTf3YetfU.twitter的內容。
它只導航到用戶將不得不搜索該帖子的移動網站。
我能做些什麼。
這是我的代碼。
<? include("overall.php");?>
<?
session_start();
require_once('mobile_device_detect.php');
$blackberrystatus = mobile_device_detect(true,true,false,true,true,true,true,false,false);
$androidstatus = mobile_device_detect(true,true,true,true,false,true,true,false,false);
$mobile = mobile_device_detect(true,true,true,true,true,true,true,false,false);
$isMobile = (bool)preg_match('#\b(ip(hone|od)|android\b.+\bmobile|opera m(ob|in)i|windows (phone|ce)|blackberry'.
'|s(ymbian|eries60|amsung)|p(alm|rofile/midp|laystation portable)|nokia|fennec|htc[\-_]'.
'|up\.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\b#i', $_SERVER['HTTP_USER_AGENT']);
if($_GET["view"]=="full"){
setcookie("passnownow[client]", "pc", $time + 1209600);
$_SESSION["client"] = "pc";
}
if ($_GET["ref"]=="android" or $_GET["ref"]=="blackberry"){
setcookie("passnownow[client]", "app", $time + 1209600);
$_SESSION["client"] = "app";
header('location: mobile/new.php?id=""');
} else if ($_SESSION["client"]=="pc" or $_COOKIE['passnownow']["client"]=="pc"){
}else if ($mobile or $isMobile){
setcookie("passnownow[client]", "mobile", $time + 1209600);
$_SESSION["client"] = "mobile";
**header('location: mobile/new.php?id=""');**
}
include("overall.php");
?>
我的問題是:如何才能通過header('location: mobile/new.php?id=""');
顯示所選鏈接如header('location: mobile/new.php?id="234"');
我添加什麼代碼來獲得所選擇的鏈接的頁面ID並將它傳遞給header('location: mobile/new.php?id=""');
我試過使用$_GET['']
命令,但它不起作用,即header('location: mobile/new.php?id=<?php $_GET['id']; ?>');