Home>Article>Backend Development> Detailed explanation of Laravel's task scheduling console

Detailed explanation of Laravel's task scheduling console

*文
*文 Original
2018-01-03 13:00:32 2640browse

This article mainly gives you a brief introduction to how to use the task scheduling console in Laravel, and attaches a simple example. I hope it will be helpful for everyone to learn to use the console.

Applicable scenarios: analysis data (log)

php artisan make:console 你的命令类名

Example:

php artisan make:console Check

A Check.php file has been generated in the \app\Console\Commands directory


      

You can change $signature to the command name you want

protected $signature = 'check';

It cannot be called in the console at this time and needs to be registered in Kernel.php.

protected $commands = [ 'App\Console\Commands\Check' ];

You can already use this command in the console

php artisan check

Comment: It seems useless, because php itself can also use CLI commands without the Laravel framework OK.

Related recommendations:

Explain how to customize encryption services in laravel

Exploring how Laravel's middleware is implemented

Laravel optimization of split routing files

The above is the detailed content of Detailed explanation of Laravel's task scheduling console. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn