阅读(289) (18)

Laravel 8 before {#collection-method}

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

before 方法返回字符串中指定值之前的所有内容:

use Illuminate\Support\Str;

$slice = Str::of('This is my name')->before('my name');

// 'This is '