阅读(3864) (7)

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

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

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

use IlluminateSupportStr;

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

// a quick brown fox jumps over the lazy dog