【发布时间】:2020-02-27 05:25:43
【问题描述】:
我正在使用 Laravel,在显示数据库中存储的图像时,图像没有显示出来:
$post -> image has posts/1lSBv7Ana8Lonj9Au37IrujjnnEaYgzNWyamch33.jpeg as image location, still image doesn't show up.
index.blade.php
<tbody>
@foreach ($posts as $post)
<tr>
<td>
<img src="{{$post->image}}" width="60px" height="60px" alt="image">
</td>
<td>{{$post->title}} </td>
</tr>
@endforeach
</tbody>
和 PostsController 一样
public function index()
{
return \view('posts.index')->with('posts', Post::all());
}
【问题讨论】:
-
使用 src="{{asset($post->image)}}"
-
给出存储图片的文件夹路径
标签: php html laravel ubuntu content-management-system