collect() 创建集合
辅助函数 collect 为给定数组返回一个新的 IlluminateSupportCollection 实例
$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'
]
]);
如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术
转载请注明:laravel中将数组转为集合 出自老鄢博客 | 欢迎分享