Laravel 8 split {#collection-method}
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"])