首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >参数和选项有什么区别?

参数和选项有什么区别?
EN

Stack Overflow用户
提问于 2013-07-24 22:44:20
回答 1查看 5.4K关注 0票数 24

我不太确定这个术语存在于哪个级别,但是在php-framework Laravel中,有一个名为Artisan的命令行工具,用于创建cronjob。(也称为命令)。您可以像这样指定参数和选项:

/**
 * Get the console command arguments.
 *
 * @return array
 */
protected function getArguments()
{
    return array(
        array('example', InputArgument::REQUIRED, 'An example argument.'),
    );
}

/**
     * Get the console command options.
     *
     * @return array
     */
    protected function getOptions()
    {
        return array(
            array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
        );
    }

这两者有什么不同?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-24 22:53:44

查看artisan migrate:make帮助:

Usage:
 migrate:make [--bench[="..."]] [--create] [--package[="..."]] [--path[="..."]] [--table[="..."]] name

Arguments:
 name                  The name of the migration

Options:
 --bench               The workbench the migration belongs to.
 --create              The table needs to be created.
 --package             The package the migration belongs to.
 --path                Where to store the migration.
 --table               The table to migrate.
 --help (-h)           Display this help message.
 --quiet (-q)          Do not output any message.
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version.
 --ansi                Force ANSI output.
 --no-ansi             Disable ANSI output.
 --no-interaction (-n) Do not ask any interactive question.
 --env                 The environment the command should run under.

参数是通常需要至少提供一个参数的内容,在这种情况下,您需要提供迁移名称,否则命令将引发错误。

选项显然是可选的,您可以使用它来修改命令行为。

票数 27
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17837368

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档