pinga / crontab
基于workerman的PHP编写的crontab
v1.0
2024-01-10 15:49 UTC
Requires
- php: >=8.2
- workerman/workerman: >=4.0.20
README
基于workerman,workerman/crontab 和 hyperf/crontab 的PHP编写的具有秒级精度的crontab。
安装
composer require pinga/crontab
用法
start.php
<?php use Workerman\Worker; require __DIR__ . '/../vendor/autoload.php'; use Pinga\Crontab\Crontab; $worker = new Worker(); $worker->onWorkerStart = function () { // Execute the function in the first second of every minute. new Crontab('1 * * * * *', function(){ echo date('Y-m-d H:i:s')."\n"; }); }; Worker::runAll();
使用以下命令运行 php start.php start
或 php start.php start -d