Why is the time returned with cookies incorrect? Solutions

Source: Internet
Author: User
Tags setcookie
Why is the time returned with cookies incorrect?
First look at the cookie that has the last login information
if (!empty ($_cookie[' lastvisit ')) {

echo "The time you last logged in is". $_cookie[' lastvisit ';
Update Time
Setcookie ("Lastvisit", Date ("Y-m-d h:i:s"), Time () +600);
}else{
echo "You are the first time to log in";
Setcookie ("Lastvisit", Date ("Y-m-d h:i:s"), Time () +600);
}
?>
The time I returned was completely different from the time of my computer system.
I set a time zone, the time zone should be the Chongqing time zone is useless, time has not changed
What's going on after that?

------Solution--------------------
Setcookie ("Lastvisit", Date ("Y-m-d h:i:s"), Time () +600);

Setcookie ("Lastvisit", Date ("Y-m-d h:i:s"), Time () +600);

There are differences.

------Solution--------------------
The upstairs is awesome.
------Solution--------------------
It's like a 24-hour system, a 12-hour system.
------Solution--------------------
Time format issues.
------Solution--------------------
Not good, not good.

Data retention in the client requires security, although there is no security issue.
------Solution--------------------
The reason for your problem is that you have to Setcookie before you can echo ...


Another problem is the # #
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.