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

时间:2019-06-26 14:32:52

标签: php laravel command-line-interface

我的命令在命令行上运行时有效:

serial() = sheetnm1.Range("serial_nr").Value 
boolean1() = sheetnm1.Range("boolean_nr").Value
dates1() = sheetnm1.Range("dates1_nr").Value
dates2() = sheetnm1.Range("dates2_nr").Value

y = 1
For x = 1 To UBound(boolean1, 1)
    If boolean1(x, 1) = 1 Then
        For y = 1 To UBound(boolean1, 1)
            If serial(y, 1) = serial(x, 1) Then
                dates1(y, 1) = dates2(x, 1)
            End If
        Next y
    End If
Next x

sheetnm1.Range("dates1_nr") = dates1

但是当我尝试在代码中使用它时:

php artisan my:command --theFlag

Laravel找不到我的命令:

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

1 个答案:

答案 0 :(得分:2)

好的,我发现了:我猜我的Laravel有点老了,不支持这种语法。

这有效:

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