我希望你做得很好! 林想知道如何將用戶重定向到第一次訪問我的頁面的不同頁面......第二,第三,第五個使用基於cookie的腳本。將訪問者重定向到不同的網址(取決於他們訪問了多少次網頁)
例如, 用戶進入我的網站在1日時間: 重定向頁面page1.com
用戶進入我的網站第二次: 重定向頁面page2.com
3次: 重定向到頁page3.com
5倍 重定向頁面page4.com
等
我已經在這裏發現了類似的代碼:Redirect visitor to a different url if a page is accessed more than 5 times?但因爲我的PHP新手,我不知道如何重定向添加到不同數量的訪問,其中包括1-ST
if(! isset($_COOKIE["ProfileVisitCount"])){
setcookie("ProfileVisitCount", "1", time()+3600);
}
if($_COOKIE["ProfileVisitCount"] > 5){
header("Location: http://domain.com/signup");
exit();
}
else {
setcookie("ProfileVisitCount", ($_COOKIE["ProfileVisitCount"] + 1), time()+3600);
}
我將非常感激您的幫助! 謝謝
,你必須增加$ _COOKIE [「ProfileVisitCount」]值 –
可以使用switch語句用$ _COOKIE [「ProfileVisitCount」]的價值 – coder
檢查我的答案,如果你每次都遞增計數器值當用戶訪問您的網站時。 –