阅读(3720) (5)

Laravel 8 Str::contains() {#collection-method}

2021-07-03 16:54:17 更新

Str::contains 方法判断指定字符串中是否包含另一指定字符串(区分大小写):

use IlluminateSupportStr;

$contains = Str::contains('This is my name', 'my');

// true 

您亦可以传递数组的值的形式来判断指定字符串是否包含数组中的任一值:

use IlluminateSupportStr;

$contains = Str::contains('This is my name', ['my', 'foo']);

// true