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

2021-07-19 10:28 更新

Str::replaceArray 函數(shù)使用數(shù)組順序替換字符串中的給定值:

use Illuminate\Support\Str;

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

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

// 活動將在 8:30 至 9:00 之間進行 
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號