: 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.