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.
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/...
Update
In the comments, I saw someone asking whether it is
linux
orwindows
, so I will also talk about the operation method ofwindows
.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.linux crontab
Self-Baidu
crontab, queue, redis, etc. can be combined to achieve scheduled tasks
1.linux crontab
(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.