In some demand development, it is necessary to set the time period (business hours) during which the software provides services. At this time, you can choose a timer to implement it, and you can choose to have the timer detect whether the current time is within the service time every once in a while. The service time is reached and the service state is entered. The service time has not yet arrived and the non-service time period has entered. Problems you may encounter? When operations such as switching and exiting different services require multiple passes through the timer method, the consequence is that the timer is started multiple times. Causing page functionality to become confusing. How to solve this problem? The method is very simple, that is, before turning on the timer, first turn off the last turned on timer (write the timer that clears the last setting directly before turning on the timer code). In this way, no matter how many times you start the timer, you can always keep only one timer working.
Conclusion: Use global variables instead of definitions in data