Requirements:
1, to have an hour minute seconds of the real-time countdown display.
2, the user-side modification date time does not affect the countdown to the normal display (that is, the server time is the subject). In fact, this is the same as many examinations and other system time-limited function requirements.
Solution Ideas:
1, always can not use Ajax every second to get server time bar, so real-time countdown must be implemented with JavaScript. This is simple, a bunch of examples online.
2, now the problem is to resolve the user-side modification date and time on our display impact. The solution is to calculate the user's time and the server difference, so the problem is completely solved, only need to run PHP, the real-time countdown time and the server time synchronization. Theory is synchronous, but the actual test will have 1 seconds of error (the specific reason is connected with the speed, the faster the speed, the smaller the error), but this will not affect our requirements above.
Code Listing 1:
Code 2, modified some bug in code 1:
Code 3, different ideas, much simpler:
http://www.bkjia.com/PHPjc/762036.html www.bkjia.com true http://www.bkjia.com/PHPjc/762036.html techarticle requirements: 1, to have an hour minute seconds of the real-time countdown display. 2, the user-side modification date time does not affect the countdown to the normal display (that is, the server time is the subject). In fact, this ...