How to implement PHP service scheduled tasks?
typecho
typecho 2017-06-23 09:11:52
0
4
737

How to execute a certain program on the server every period of time, please give me some ideas.

typecho
typecho

Following the voice in heart.

reply all(4)
迷茫

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 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.

迷茫

linux crontab
Self-Baidu

过去多啦不再A梦

crontab, queue, redis, etc. can be combined to achieve scheduled tasks

扔个三星炸死你

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template