有没有办法将选项定义为包含空格的字符串,像这样
$myscript.php test --comment="some string"
它输出:
[RuntimeException]
Too many arguments.
test [-c|--comment="..."]
但是,如果 --comment 不包含空格(例如:“some_string”),它会起作用。
我遇到了同样的问题。也许您myscript.php
以错误的方式传递论点。在 github 上检查这个问题:https ://github.com/symfony/symfony/issues/11205
不,这与 Symfony 无关。这是关于命令行的。只需继续传递带引号的字符串。