3

作为官方文档,它并没有太多提及这一点。 App\Console\Commands\PullUsersCommand.php有一个签名,如:

protected $signature = 'pull:users {startTime} {endTime} {minutes=10} {--flag} {--star=}';

那么,如何将参数传递给它App\Console\Kernel.php

4

1 回答 1

4

您可以像这样在 App\Console\Kernel.php 中调用它:

$schedule->command('pull:users', [
    time(),  // captured with $this->argument('startTime') in command class.
    time(),  // captured with $this->argument('endTime') in command class.
    30,      // captured with $this->argument('minutes') in command class.
    '--flag',// should be without any value, just the option name, and would be captured by $this->option('minutes').
    '--star'=>12, // would be captured by $this->option('star').
])->daily();

Artisan::call门面也应该没问题。

于 2019-02-10T04:45:19.693 回答