How to execute a certain program on the server every period of time, please give me some ideas.
迷茫2017-06-23 09:13:52
The server crontab sets a scheduled task, and the scheduled task runs the PHP file in CLI mode.
PHP CLI mode documentation:
http://php.net/manual/zh/feat...
crontab documentation:
http://www.cnblogs.com/peida/...
In the comments, I saw someone asking whether it is linux
or windows
, so I will also talk about the operation method of windows
.
In the above idea, PHP CLI mode runs php files, this remains unchanged;
Scheduled tasks can Use the scheduled tasks that come with windows
to execute.
过去多啦不再A梦2017-06-23 09:13:52
crontab, queue, redis, etc. can be combined to achieve scheduled tasks
扔个三星炸死你2017-06-23 09:13:52
1.linux crontab
* * * * * command
(minute, hour, day, month, day of week, command to be executed)
2. Message middleware
3. PHP loop hangs
It is recommended to use the first method for simplicity.