阅读(3898) (30)

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

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

Str::replaceFirst 函数替换字符串中给定值的第一个匹配项 :

use Illuminate\Support\Str;

$replaced = Str::replaceFirst('the', 'a', 'the quick brown fox jumps over the lazy dog');

// a quick brown fox jumps over the lazy dog