hyperf / hyperf/nano

addCrontab 定时任务没有运行

Open
#68 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
435
Forks
26
PR merge metrics
No merged PRs in 30d

Description

```php
use Hyperf\Nano\Factory\AppFactory;
require_once __DIR__ . '/vendor/autoload.php';

$app = AppFactory::createSwow();

$app->config([
'processes'=> [ Hyperf\Crontab\Process\CrontabDispatcherProcess::class,],
'crontab' => [
'enable' => true,
],
]);

$app->addCrontab('* * * * * *', function(){
echo "A new Crontab called echo!";
$file = 'log.txt';
// 向文件追加写入内容
// 使用 FILE_APPEND 标记,可以在文件末尾追加内容
file_put_contents($file, time(), FILE_APPEND | LOCK_EX);
});

```
定时回调里面的代码没有执行

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.