阅读(591) (10)

Laravel 8 Arr::dot() {#collection-method}

2021-07-02 16:49:00 更新

Arr::dot 函数将多维数组中所有的键平铺到一维数组中,新数组使用「.」符号表示层级包含关系:

use IlluminateSupportArr;

$array = ['products' => ['desk' => ['price' => 100]]];

$flattened = Arr::dot($array);

// ['products.desk.price' => 100]