我创建了一个新命令:
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/