【发布时间】:2016-09-25 20:27:41
【问题描述】:
尝试在 laravel 5.2 上设置示例控制台命令,但它不起作用
我跑了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 时,该命令未在给定签名下列出
我错过了什么? 谢谢
【问题讨论】:
-
你添加到
kernel.php的数组中了吗?见laravel.com/docs/5.2/artisan#registering-commands