I encountered a very annoying problem today. There is a project to develop a PHP interface for web pages embedded in the client. The test took 6 iPhones for testing. There was no problem in the test on 5 devices. Only one version was 9.1. iPhone6s has been not working, it's very strange and I can't find the reason.
Then, I used fiddler to capture packets and found that this device did not generate cookies after the interface request that should generate cookies, so the interfaces that need to use cookies in the future cannot be used. Since the web page is embedded in the client, I went to the settings to see if cookies were enabled in Safari. After checking, I found that cookies were also enabled.
This is so weird! What other reasons could there be? I glanced at the time on the device. It was wrong. It was different from the current time. It was half an hour faster (I didn't pay attention to the date at the time, so it should be at least one day faster because the cookie expiration time set by the server is 1 day). After adjusting the date to the current correct time, the cookie can be generated.
Later, the experiment reproduced this problem. When the cookie setting expiration time is 1 day, it is assumed that the current cookie setting time is 22:00 on March 24, 2016 (server time), and the client time is March 2016. At 22:00 on the 25th, setting the cookie will not be successful, because the cookie will immediately expire as soon as it is set.
The above introduces how to set cookies in PHP on the server side, but it does not take effect on the client side. It also includes relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.