The server PHP sets the cookie, and the client does not take effect

Source: Internet
Author: User
: This article mainly introduces how to set cookies in PHP on the server. the client does not take effect. if you are interested in the PHP Tutorial, refer to it. Today, I encountered a very bad problem. I had a PHP development interface for a project to apply embedded web pages on the client. I took 6 iPhones for the test, and there were no problems in testing the five devices, I have never been able to use the 9.1 version of the iPhone 6 s. It is strange that I cannot find the cause.

Then, using fiddler to capture packets found that the device did not generate a cookie after the interface request for generating the cookie, so the interface for using the cookie will not go any further. Because the webpage is embedded in the client, go to the settings to check whether the cookie is enabled in safari. after checking, the cookie is also enabled.

This is really strange! Why? A glance at the device's time. no, it's not the same as the current time. it's almost half an hour (I didn't pay attention to the date at the time, it should be at least one day, because the cookie expiration time set by the server is one day ). After the date is set to the current correct time, the cookie will be generated.

Later, the experiment reproduced this problem. when the cookie expiration time is set to one day, assume that the current cookie time is set to on January 1, March 24, 2016 (server time ), when the client time is on January 1, March 25, 2016, the cookie setting will not be successful, because the cookie setting will immediately become invalid.

The above describes how to set the cookie in PHP on the server end. the client does not take effect, including some content. I hope my friends who are interested in the PHP Tutorial can help me.

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.