Swoole implements a simple crontab timer
- Swoole implements simple crontab timer introduction
- 1. First install the swoole extension;
- 2. It is also very simple to use, execute directly in the project root directory: php think test code is written very general, just to provide an idea to carry out daily tasks, I hope you forgive me, if you have good suggestions, I hope to help improve Now, thank you great gods.
- GIT address:
Swoole implements simple crontab timer introduction
Hello, everyone, Xiao An uses the SWOOLE extension on TP5 to implement a simple crontab function similar to the linux system, but due to the time limit of swoole, only the time can be set (such as 23:59:59 /var/www/ html/php think Task.php), executed daily.
1. First install the swoole extension;
2. It is also very simple to use, execute directly in the project root directory: php think test code is written very general, just to provide an idea to carry out daily tasks, I hope you forgive me, if you have good suggestions, I hope to help improve Now, thank you great gods.
When instantiating the Task class, set the time you want to execute the php or shell script every day.
GIT address:
https://github.com/anyanfei/AYF_Swoole_Timer.git
I'm not smart, I just try to make a better PHPER, so that my things can be more useful in actual projects.