简体   繁体   English

Laravel的Artisan :: call()不适用于标志参数

[英]Laravel's Artisan::call() doesn't work with flag parameters

My command works when I run it on the command line : 我的命令在命令行上运行时有效:

php artisan my:command --theFlag

But when I try to use it in code : 但是当我尝试在代码中使用它时:

Artisan::call("my:command --theFlag");

Laravel cannot find my command : Laravel找不到我的命令:

Exception : The command "my:command --theFlag" does not exists

Ok I have found out : I guess my Laravel is a bit old and doesn't support this syntax. 好的,我发现了:我猜我的Laravel有点旧了,不支持这种语法。

This works : 这有效:

Artisan::call("my:command", [
    "--theFlag" => true
]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM