【发布时间】:2019-06-23 17:09:08
【问题描述】:
我正在尝试显示存储在本地的图像。上传的文件在 Storage 文件夹中
我正在使用下面的代码来显示图像
@foreach($publications as $p)
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="{{URL('public/storage/app/{$p->file_name}')}}" alt="{{$p->file_name}}" />
<div class="card-body">
<p class="card-text">{{$p->description}}</p>
</div>
</div>
@endforeach
但我得到了:
怎么了?
编辑 1
我用php artisan storage:link,控制台显示
The [public/storage] directory has been linked.
还是不行
【问题讨论】:
-
也许您忘记将您的
storage/app/public文件夹链接到public文件夹。尝试运行php artisan storage:link -
@LeventeOtta 不工作但控制台显示
The [public/storage] directory has been linked. -
您的
public文件夹看起来如何? (如果可能,添加屏幕截图)
标签: php laravel image laravel-5.8