是否可以在 Symfony 控制台中将参数作为命名空间传递?

Is it possible to pass parameter as namespace in Symfony console?

我想将参数传递给 Symfony 控制台,因此 commandName:parameter1 parameter2。这可能吗?我该怎么做?

是的,可以使用 addArgument 方法。你应该在构造函数中调用它。有a full example in the documentation解释了如何使用它。

但是,格式将为 commandName parameter1 parameter2app:commandName parameter1 parameter2