我想在我的 View 中显示图像。这些图像位于公共(public)文件夹中,文件夹名为 img。
我尝试过以下解决方案:
<img href="{{URL::to('img/zajeciadodatkowe.png')}}" alt="Image" height="200" width="200">
<img src="{{URL::to('img/zajeciadodatkowe.png')}}" alt="Image" height="200" width="200">
<img href="{{URL::asset('img/zajeciadodatkowe.png')}}" alt="Image" height="200" width="200">
<img src="{{URL::asset('img/zajeciadodatkowe.png')}}" alt="Image" height="200" width="200">
<img href="{{asset('img/zajeciadodatkowe.png')}}" alt="Image" height="200" width="200">
<img src="{{asset('img/zajeciadodatkowe.png')}}" alt="Image" height="200" width="200">
当我将 laravel 应用程序放到开发服务器上时,出现了这个问题。 有人有什么建议吗?
最佳答案
使用asset()
助手:
<img src="{{ asset('img/zajeciadodatkowe.png') }}">
并确保 zajeciadodatkowe.png
图像位于 public/img
目录中。
关于Laravel 图片不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41894539/