【发布时间】:2021-06-02 23:02:08
【问题描述】:
$比较结果:-
代码:-
public function remove(Request $request)
{
$compare = $request->session()->get('compare', collect([]));
$compare->forget($request->id);
return back();
}
我想删除数组 $compare 中的数据,我正在从会话中检索数据,但使用键值删除相关索引,包括其值。
array:3 [
0 => "4"
1 => "2"
2 => "1" ]
forget() 或 pull()
0 => "4"
使用它的值"4"
【问题讨论】:
标签: php laravel session eloquent