阅读(1369) (6)

Laravel 8 start {#collection-method}

2021-07-05 09:43:53 更新

start 方法用于将某个值添加到字符串的头部,若该字符串没有以此值开头:

use Illuminate\Support\Str;

$adjusted = Str::of('this/string')->start('/');

// /this/string

$adjusted = Str::of('/this/string')->start('/');

// /this/string