如何在Laravel框架中拆分字符串并在表格中显示它?我从我的数据库中获取的数据只有一列,但是是一个字符串,例如{ 1234, normal, r4r3r2 }
。我想通过逗号将其拆分为三个不同的部分/值,并在三列的表格中显示。
目前,我只能显示未拆分的数据。
我的HomeController:
public function index()
{
$test = Test::all();
return view('home')->with('test', $test);
}
我的home.blade.php:
<ol>
@foreach($test as $row)
<li>{{ $row->data }}</li>
@endforeach
</ol>