->after() on Laravel artisan Schedule Command with closure 是一个字符串?

->after() on Laravel artisan Schedule Command with closure is a string?

$slackNotify = function() use (&$info) { ... };
$schedule->command('Calc:RPI 1 2015')->cron('0 */2 * 8-12 *')
    ->withoutOverlapping()->sendOutputTo($this->path . 'rpi.html')
    ->after($slackNotify('My message here'));

Error: Argument 1 passed to Illuminate\Console\Scheduling\Event::after() must be an instance of Closure, string given, ...

为什么它认为 $slackNotify(...) 是一个字符串?

事实证明我使用的是 lambda 而不是匿名函数(NEARLY 是同一回事,但仍然不是)。

->after() 命令需要一个匿名函数,所以我只需要添加它并将我的 lambda 传递给它:

WAS/拉姆达:

->after($slackNotify('My Message Here'));

是/匿名:

->after(function() use ($slackNotify) {$slackNotify('My Message Here');});

感谢 rizqi 帮助解释我真正在做什么。