Php Laravel控制台命令不工作
正在尝试在laravel 5.2上设置示例控制台命令,但它不起作用 我运行了php artisan make:console CoolCommand 这是我的档案Php Laravel控制台命令不工作,php,laravel,console,Php,Laravel,Console,正在尝试在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 com
<?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
时未列出该命令,则会忘记按说明注册该命令。打开app/Console/Kernel.php
并输入命令
protected $commands = [
Commands\CoolCommand::class
];
您是否已将其添加到
kernel.php
中的数组中?看见