gpt4 book ai didi

php - 从 php 调用 Artisan 队列重试

转载 作者:行者123 更新时间:2023-12-02 05:59:56 25 4
gpt4 key购买 nike

我在从 php 调用 artisan 队列时遇到问题。我想在 Beanstalkd 队列中列出失败的作业并制作一个重试按钮。

我想调用 php artisan queue:retry{id}

所以,我将这段代码放在 route.php 中

Route::get('retry/{id}', function($id){
Artisan::call("queue:retry $id");
});

返回错误

InvalidArgumentException' with message 'Command "queue:retry 12" is not defined.

Did you mean one of these? queue:retry queue:forget queue:failed-table queue:flush queue:failed queue:listen queue:subscribe queue:work'

谁能帮帮我?谢谢

最佳答案

我刚刚尝试了 limonte 的回答,虽然它非常接近我的需要,但我注意到 RetryCommand.php 期望 id 值是一个数组,所以你需要有一个像这样的嵌入式数组:

Artisan::call('queue:retry', ['id' => [$id]]);

关于php - 从 php 调用 Artisan 队列重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29367005/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com