簡體   English   中英

Laravel控制台命令不起作用

[英]Laravel console command not working

試圖在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時,命令未在給定的簽​​名下列出

我想念什么? 謝謝

如果在鍵入php artisan時未列出該命令,則您忘記了按此處所述注冊命令。 打開app/Console/Kernel.php並輸入命令。

 protected $commands = [
     Commands\CoolCommand::class
 ];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM