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