Zac*_*ous 2 cookies redirect detect
有没有一种方法,如果用户访问我的网站,第一次检测,如果是这样,他们重定向到一个页面,例如,指数首次-visitor.php - 如果他们不是第一次访问,它将它们发送到index.php
如果有办法做到这一点,请演示如何.
小智 10
把它放在index.php的顶部
<?php
if ($_COOKIE['iwashere'] != "yes") {
setcookie("iwashere", "yes", time()+315360000);
header("Location: http://example.com/index-first-time-visitor.php");
}
?>
Run Code Online (Sandbox Code Playgroud)
该cookie将存活10年,之后,用户将再次成为"新"访问者.
| 归档时间: |
|
| 查看次数: |
7326 次 |
| 最近记录: |