阅读(1860) (0)

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

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

Str::replaceArray 函数使用数组顺序替换字符串中的给定值:

use Illuminate\Support\Str;

$string = 'The event will take place between ? and ?';

$replaced = Str::replaceArray('?', ['8:30', '9:00'], $string);

// 活动将在 8:30 至 9:00 之间进行