Command line 在console.php中拥有Laravel php artisan命令
我在Command line 在console.php中拥有Laravel php artisan命令,command-line,laravel-5.4,laravel-routing,Command Line,Laravel 5.4,Laravel Routing,我在app/Console/Commands/sendmail.php中有一个包含以下内容的文件: <?php namespace App\Console\Commands; use Illuminate\Console\Command; class SendEmail extends Command { protected $signature = 'send_email'; protected $description = 'Command description';
app/Console/Commands/sendmail.php
中有一个包含以下内容的文件:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SendEmail extends Command
{
protected $signature = 'send_email';
protected $description = 'Command description';
public function __construct()
{
parent::__construct();
}
public function handle()
{
echo "hello wordl\n";
}
}
问题是:我需要在
routes/console.php
文件中写入什么来运行这个命令?您得到了解决方案吗?仍然没有…是的,我们已经解决了这个问题。问题是我调用了config/app.php文件上的url()。当我删除此选项时,artisan命令将顺利运行
use App\Console\Commands\SendEmail;
Artisan::command('send_email', function() { });