阅读(4985) (10)

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

2021-07-03 15:40:58 更新

Arr::set 函数使用「.」符号在多维数组中设置指定键的值:

use IlluminateSupportArr;

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

Arr::set($array, 'products.desk.price', 200);

// ['products' => ['desk' => ['price' => 200]]]