Laravel 8 endsWith {#collection-method}
endsWith
方法用于判断指定字符串是否以另一指定字符串结尾:
use Illuminate\Support\Str;
$result = Str::of('This is my name')->endsWith('name');
// true
您亦可以传递数组的值的形式来判断指定字符串是否包含指定数组中的任一值:
use Illuminate\Support\Str;
$result = Str::of('This is my name')->endsWith(['name', 'foo']);
// true
$result = Str::of('This is my name')->endsWith(['this', 'foo']);
// false