Home > php教程 > php手册 > laravel custom command

laravel custom command

WBOY
Release: 2016-08-18 08:57:58
Original
1248 people have browsed it

1. Custom command: Save the custom command in app/Console/Commands, or configure automatic loading in the composer.json file, and freely choose where you want to place it

php artisan make:console ShowGreet​(Create a script to write commands, the script exists app/Console/Commands) -> Define $signature (name of the command) in ShowGreet -> Process the code logic in the handle method -》Register the command in app/Console/Commands/kernel.php

http://laravel-china.org/docs/5.1/artisan The document explains the operation of writing commands very clearly and easily. Here we only briefly explain the two commonly used situations

Some commands require parameters, which can be defined in the $signature attribute in ShowGreet.php

Enclosed in curly brackets, it is required to have parameters

Parameters are optional

There is also the logical processing of the handle method, refer to the link above

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template