阅读(2203) (9)

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

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

Arr::exists 检查给定的键是否存在提供的数组中:

use Illuminate\Support\Arr;

$array = ['name' => 'John Doe', 'age' => 17];

$exists = Arr::exists($array, 'name');

// true

$exists = Arr::exists($array, 'salary');

// false