Why is the return time of the cookie incorrect? & Lt ;? Php first checks whether the cookie contains information about the last logon. if (! Empty ($ _ COOKIE [lastvisit]) {echo & quot; your last logon time was & quot ;. $ _ COOKIE [lastvisit]; update time setcookie (& quot; lastvisit & quot;, why is the returned Time of dat cookie incorrect?
// First, check whether the cookie contains the last logon information.
If (! Empty ($ _ COOKIE ['lastvisit']) {
Echo "the last time you log on is". $ _ COOKIE ['lastvisit'];
// Update time
Setcookie ("lastvisit", date ("Y-m-d H: I: s"), time () + 600 );
} Else {
Echo "this is your first logon ";
Setcookie ("lastvisit", date ("Y-m-d h: I: s"), time () + 600 );
}
?>
The time I returned was totally different from the time on my computer system.
I set the time zone, and it is useless to set the time zone to the Chongqing time zone. The time has not changed at all.
What's next?
------ Solution --------------------
Setcookie ("lastvisit", date ("Y-m-d H: I: s"), time () + 600 );
Setcookie ("lastvisit", date ("Y-m-d h: I: s"), time () + 600 );
There is a difference.
------ Solution --------------------
Powerful upstairs.
------ Solution --------------------
It seems that one is a 24-hour system and the other is a 12-hour system.
------ Solution --------------------
Time format problems.
------ Solution --------------------
Not good, not good ..
Security should be considered when data is stored on the client, although there is no security problem.
------ Solution --------------------
The reason for your problem is that you need to setcookie before you can echo ......
In addition, the problem lies in #1.