cookie,该如何处理

WBOY
Release: 2016-06-13 10:11:54
Original
950 people have browsed it

cookie

header('Content-Type:text/html;charset=utf-8');
if(!empty($_COOKIE['lastVist'])) {
echo "你上次登陆的时间是".$_COOKIE['lastVisit'];
setcookie("lastVisit",date("y-m-d H:i:s"),time()+24*3600*30);

}else {
echo "你是第一次登录";
setcookie("lastVisit",date("y-m-d H:i:s"),time()+24*3600*30);
}


?>

cookie初始化失败,
老是第一次登陆,
无法显示上次登陆时间,是怎么回事?

------解决方案--------------------
if(!empty($_COOKIE['lastVisit'])) {

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template