阅读(703)
赞(4)
Laravel 8 endsWith {#collection-method}
2021-07-03 16:54:27 更新
endsWith
方法用于判断指定字符串是否以另一指定字符串结尾:
use IlluminateSupportStr;
$result = Str::of('This is my name')->endsWith('name');
// true
您亦可以传递数组的值的形式来判断指定字符串是否包含指定数组中的任一值:
use IlluminateSupportStr;
$result = Str::of('This is my name')->endsWith(['name', 'foo']);
// true
$result = Str::of('This is my name')->endsWith(['this', 'foo']);
// false