How to regularly execute a PHP program without the scheduled tasks on linux or windows? How to regularly execute a PHP program without the scheduled tasks on linux or windows?
Reply content:
How to regularly execute a PHP program without the scheduled tasks on linux or windows?
If you do not need an external timer, you can only use the following two methods.
1. Start a php process and keep running in the background. Make a timer to check whether there are any tasks that should be executed.
2. Events are triggered by the user at the front-end. If the user accesses the event, check whether there are any tasks to be executed.
Ps. Under what circumstances will this egg pain need be met?
For php pages (that is, you can access them through the web), you can use third-party web page monitoring. The minimum time is five minutes.
Otherwise, I cannot figure out which environment I can use crontab.
Php cannot be resident in memory unless you are running in the command line. Therefore, if php is run in web mode, this function cannot be implemented.
Our wonderful practice is to use the automatic refresh function of the digital browser ..
Ignore_user_abort (); set_time_limit (0 );
In the program, when the while (true) endless loop and the Judgment time are reached, it will be executed.
To facilitate control, you can read a file. If the file is 0, exit. You can modify the file content to control the process termination.