Fre*_*man 1 php cookies session-timeout session-cookies
您好,我有一个 php 页面,我想为每个用户只显示一次。
我认为这可能通过 cookie、会话超时或会话 cookie 来实现。
但我不确定。
谢谢你的好心 :)
你回答了你自己的问题——通过设置cookie。
// check if they've been here, if they haven't set
// a cookie for subsequent visits
if($_COOKIE['beenhere']) {
setcookie("beenhere", '1');
}
else {
// where you want them to go if they've seen this page
header('Location: http://www.example.com/');
Run Code Online (Sandbox Code Playgroud)
了解更多信息:
如果您希望单个用户不再看到该页面,则必须设置 cookie 的过期时间(请参阅上面的链接页面),因为关闭浏览器将消除 cookie,正如我在上面设置的那样。
| 归档时间: |
|
| 查看次数: |
7982 次 |
| 最近记录: |