pinga/crontab

基于workerman的PHP编写的crontab

v1.0 2024-01-10 15:49 UTC

This package is auto-updated.

Last update: 2024-09-10 17:10:14 UTC


README

基于workermanworkerman/crontabhyperf/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 startphp start.php start -d