gumphp / think-crontab
workerman/crontab for thinkphp
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/gumphp/think-crontab
Requires
- topthink/framework: ^v6.1
- workerman/crontab: ^v1.0
This package is auto-updated.
Last update: 2025-09-15 08:44:53 UTC
README
composer require gumphp/think-crontab
使用
<?php namespace app\crontab; use gumphp\crontab\Crontab; class Test extends Crontab { // 每秒执行一次 protected $rule = '* * * * * *'; public function handle() { $message = __METHOD__ . "\t" . date('Y-m-d H:i:s') . PHP_EOL; error_log($message, 3, runtime_path() . 'debug.log'); } }
把
Test
加入config/crontab.php
的handlers
配置
<?php return [ # ... 'handlers' => [ \app\crontab\Test::class, ], ];
启动守护进程
php think crontab start