阅读(4473) (3)

Laravel 8 isNotEmpty {#collection-method}

2021-07-05 09:43:49 更新

isNotEmpty 方法用于判断指定字符串是否不为空:

use Illuminate\Support\Str;

$result = Str::of('  ')->trim()->isNotEmpty();

// false

$result = Str::of('Laravel')->trim()->isNotEmpty();

// true