【发布时间】:2019-04-14 05:48:00
【问题描述】:
获取数组数据并使用explode 我已经分离了内容。现在,我想在列表中打印这些数据。但产品正在生产线上。我尝试使用“break tag”和“list tag”所有可能的方式。
这里是代码
<tbody id="test">
@foreach ($data['samplingData'] as $key => $samplingData)
<tr> <td>{{$samplingData->doctor_name}}</td>
<td>{{$samplingData->date}}</td>
@foreach(explode(',', $samplingData->products) as $product)
<td> {{$product}} </td>
@endforeach
<td>{{$samplingData->quantity}}</td> </tr>
@endforeach
</tbody>
数据以这种方式打印
Name date products quantity
a 12-12-12 a a a a 1 1 1 1
我想这样打印
Name date products quantity
a 12-12-12 a 1
a 1
a 1
我尝试在 td 中添加 tr 以及在 td 中添加列表。
请帮我格式化数据。
【问题讨论】:
-
您在
{{$product}}之后尝试过<BR/>吗?<td> {{$product}} <BR/> </td> -
是的,我试过了。它没有用。因为我用过 td.它是连续打印产品。我尝试在 td 中创建 tr。还是不行。
-
<td>@foreach(explode(',', $samplingData->products) as $product) {{$product}} <BR/> @endforeach</td>? -
知道了。非常感谢
-
它解决了你的问题吗?
标签: php html css laravel laravel-5