我试图将数据库中的图像显示到树枝文件中,但它不起作用,图像未显示。我不知道问题出在哪里。
图像名称作为字符串存储在数据库中。
<tr class="">
<td>{{ boutique.getId() }}</td>
<td>{{ boutique.getNomBoutique() }}</td>
<td>{{ boutique.getNomResponsableBoutique() }}</td>
<td>{{ boutique.getAdresse() }}</td>
<td>{{ boutique.getContact() }}</td>
<td>{{ boutique.getFournisseur() }}</td>
<td>{{ boutique.getType() }}</td>
<td><img src="{{ asset('public/images/{{ boutique.getImage()}}') }}" class="img-rounded"/></td>
<td><a href="#" class="btn btn-outline-success btn-sm">View Order</a></td>
<td><a href="#" class="btn btn-outline-warning btn-sm">Cancel</a></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
你写了{{ asset('public/images/{{ boutique.getImage()}}') }}。这是行不通的,您需要像这样正确连接字符串:
{{ asset('public/images/' ~ boutique.getImage()) }}
Run Code Online (Sandbox Code Playgroud)
如果需要,您还可以在双引号字符串中使用字符串插值:
{{ asset("public/images/#{boutique.getImage()}") }}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8358 次 |
| 最近记录: |