laravel中将数组转为集合

collect() 创建集合
辅助函数 collect 为给定数组返回一个新的 Illuminate\Support\Collection 实例

```
$collection = collect([
[
'user_id' => '1',
'title' => 'Helpers in Laravel',
'content' => 'Create custom helpers in Laravel',
'category' => 'php'
],
[
'user_id' => '2',
'title' => 'Testing in Laravel',
'content' => 'Testing File Uploads in Laravel',
'category' => 'php'
]
]);

```

    A+
发布日期:2022年11月26日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: