阅读(2219) (10)

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

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

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

use IlluminateSupportArr;

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

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

// true

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

// false