Laravel 中使用 PHP artisan xx:xx 命令时,如何调用 Commands 类中的 handle 方法的?
1: 定义自己 Commands类
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\xxx\xx;
class xx extends Command
{
protected $signature = 'xx:xx';
public function handle()
{
$obj = new xx();
$obj->method();
}
}
2:控制台输入
php artisan xx:xx
问题:如何程序自动调用了 handle 方法 ???
追加问题:handle 和 fire 区别???
推荐文章: