阅读(3416)
赞(16)
Laravel 8 split {#collection-method}
2021-07-05 09:43:53 更新
split 方法使用正则表达式将字符串分割到集合中:
use Illuminate\Support\Str;
$segments = Str::of('one, two, three')->split('/[\s,]+/');
// collect(["one", "two", "three"]) split 方法使用正则表达式将字符串分割到集合中:
use Illuminate\Support\Str;
$segments = Str::of('one, two, three')->split('/[\s,]+/');
// collect(["one", "two", "three"])