How do I schedule a PHP program without planning tasks on Linux or Windows?
Reply content:
How do I schedule a PHP program without planning tasks on Linux or Windows?
If you don't use an external timer, there are only two ways to do it.
1, start a PHP process has been running in the background, do a timer, check that there is no task should be executed
2, through the user in the foreground to fire events, there is user access, then go to check if there is no need to perform the task
PS, in what circumstances will the need for this egg ache be met?
PHP page (that is, can be accessed through the web), can be used third-party web monitoring, the shortest five minutes.
Or I can't figure out what kind of environment can not use crontab.
PHP cannot reside in memory unless you are running on the command line. Therefore, if it is a web-run PHP, it is not possible to implement this function.
Our company's wonderful practices, using the digital browser's automatic refresh feature.
ignore_user_abort();set_time_limit(0);
In the program, the while (true) loop is passed and the time is judged, it is executed.
For ease of control, you can also read a file, if the file is 0 exit, so you can modify the file content to control the process end.