【发布时间】:2021-05-02 07:35:56
【问题描述】:
我需要使用类似这样的东西:
return redirect()->action([HomeController::class, 'index'])->with('data'=>$data);
但我不知道怎么做?
【问题讨论】:
-
我认为this 是您要找的。span>
我需要使用类似这样的东西:
return redirect()->action([HomeController::class, 'index'])->with('data'=>$data);
但我不知道怎么做?
【问题讨论】:
Action 方法接受两个都是数组的参数。第二个数组是键的关联数组,作为参数名称和参数值的值。 在你的情况下,它会是
return redirect()->action(
[HomeController::class, 'index'],
['data' => $data]
);
Docs.
【讨论】: