gpt4 book ai didi

php - Laravel 自定义命令不起作用

转载 作者:可可西里 更新时间:2023-11-01 13:08:32 25 4
gpt4 key购买 nike

我创建了一个新命令:

php artisan make:console CrawlData

然后我改了两个变量:

protected $signature = 'make:crawl';
protected $description = 'My crawling command';

问题是当我运行时:

php artisan make:crawl

输出:

[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "make:crawl" is not defined.

最佳答案

您还需要在 App\Console\Kernel 类中注册该命令以使其被识别:

protected $commands = [
...
\App\Console\Commands\CrawlData::class,
];

您可以在 Registering Commands 中阅读更多相关信息文档。


Starting with Laravel 5.5 commands in app/Console/Commands are automatically registered.

关于php - Laravel 自定义命令不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35879222/

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