Laravel 8 Arr::dot() {#collection-method}
Arr::dot
函数将多维数组中所有的键平铺到一维数组中,新数组使用「.」符号表示层级包含关系:
use Illuminate\Support\Arr;
$array = ['products' => ['desk' => ['price' => 100]]];
$flattened = Arr::dot($array);
// ['products.desk.price' => 100]
Arr::dot
函数将多维数组中所有的键平铺到一维数组中,新数组使用「.」符号表示层级包含关系:
use Illuminate\Support\Arr;
$array = ['products' => ['desk' => ['price' => 100]]];
$flattened = Arr::dot($array);
// ['products.desk.price' => 100]