Laravel 8 keys() {#collection-method}
2021-07-19 09:40 更新
keys
方法返回集合中所有的键:
$collection = collect([
'prod-100' => ['product_id' => 'prod-100', 'name' => 'Desk'],
'prod-200' => ['product_id' => 'prod-200', 'name' => 'Chair'],
]);
$keys = $collection->keys();
$keys->all();
// ['prod-100', 'prod-200']
以上内容是否对您有帮助:
更多建议: