Laravel Artisan 命令行:查看命令帮助信息
问题
如何获得一个 Artisan 命令的帮助信息?
回答
每个 Artisan 命令都包含有帮助信息,我们只需通过 help
命令或 -h
或 --help
选项即可显示一个命令的帮助信息。
比如查看 migrate
命令的帮助信息,可通过如下方式:
通过 help
后带要查看帮助的命令名:
$ php artisan help migrate
通过在命令后加 -h
选项:
$ php artisan migrate -h
通过在命令后加 --help
选项:
$ php artisan migrate --help
以上方式的输出结果是相同的:
Usage:
migrate [options]
Options:
--database[=DATABASE] The database connection to use.
--force Force the operation to run when in production.
--path[=PATH] The path of migrations files to be executed.
--pretend Dump the SQL queries that would be run.
--seed Indicates if the seed task should be re-run.
--step Force the migrations to be run so they can be rolled back individually.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Run the database migrations