Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
179 views
in Technique[技术] by (71.8m points)

laravel5.4的routes文件夹中的console.php和channels.php是做什么的?

laravel5.4的routes文件夹中的console.php和channels.php是做什么的?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

console.php用于使用闭包的形式定义Artisan命令,比如

Artisan::command('build {project}', function ($project) {
    $this->info("Building {$project}!");
});

上面这种命令是可以直接在console.php中创建的,在app/Console/Kernel.php文件中会自动加载该文件中的内容。

channels.php用于定义Laravel的Event Broadcasting功能对channels的授权规则,详见:Event Broadcasting


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...