Laravel控制台命令不工作 [英] Laravel console command not working
本文介绍了Laravel控制台命令不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试在laravel 5.2上设置示例控制台命令,但不起作用
trying to setup an example console command on laravel 5.2 but it's not working
我运行 php artisan make:console CoolCommand
这是我的档案
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class CoolCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'be:cool';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Allows you to be cool';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo "Yes you are very cool!";
}
}
当我命中php artisan时,给定的签名
When I hit php artisan the command is not listed under the given signature
我缺少什么?
感谢
What am I missing? Thanks
推荐答案
如果键入 php artisan
时,您忘记按此处所述注册命令。打开 app / Console / Kernel.php
并输入命令。
If it's not listed when you type php artisan
, you forgot to register the command as described here. Open app/Console/Kernel.php
and enter your command.
protected $commands = [
Commands\CoolCommand::class
];
这篇关于Laravel控制台命令不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文