Allen_Go 1年前

修改理由:

调度频率并不支持秒级别

详细描述:

php artisan schedule:work
BadMethodCallException

Method Illuminate\Console\Scheduling\Event::everySecond does not exist.

at vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php:113
109▕ */
110▕ public function __call($method, $parameters)
111▕ {
112▕ if (! static::hasMacro($method)) {
➜ 113▕ throw new BadMethodCallException(sprintf(
114▕ 'Method %s::%s does not exist.', static::class, $method
115▕ ));
116▕ }
117▕
i Bad Method Call: Did you mean Illuminate\Console\Scheduling\Event::everySixHours() ?

1 app/Console/Tasks/CrontabTask.php:30
Illuminate\Console\Scheduling\Event::__call("everySecond", [])

相关信息:


此投稿由 mengguo 1年前 合并。

标题修改:

+ 任务调度

内容修改:

红色背景 为原始内容

绿色背景 为新增或者修改的内容

OldNewDifferences
105105方法 | 描述
106106------------- | -------------
107107`->cron('* * * * *');` | 自定义 Cron 计划执行任务
108 `->everySecond();` | 每秒钟执行一次任务  
109 `->everyTwoSeconds();` | 每2秒钟执行一次任务  
110 `->everyFiveSeconds();` | 每5秒钟执行一次任务  
111 `->everyTenSeconds();` | 每10秒钟执行一次任务  
112108`->everyFifteenSeconds();` | 每15秒钟执行一次任务
113109`->everyTwentySeconds();` | 每20秒钟执行一次任务
114110`->everyThirtySeconds();` | 每30秒钟执行一次任务