阅读(2983)
赞(9)
Laravel 8 split() {#collection-method}
2021-07-01 15:42:07 更新
split
方法将集合按照给定的值拆分:
$collection = collect([1, 2, 3, 4, 5]);
$groups = $collection->split(3);
$groups->all();
// [[1, 2], [3, 4], [5]]
split
方法将集合按照给定的值拆分:
$collection = collect([1, 2, 3, 4, 5]);
$groups = $collection->split(3);
$groups->all();
// [[1, 2], [3, 4], [5]]