阅读(2240) (9)

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

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

Arr::forget 函数使用「.」符号从深度嵌套的数组中删除给定的键值对:

use Illuminate\Support\Arr;

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

Arr::forget($array, 'products.desk');

// ['products' => []]