当尝试在laravel上加载我的图像时,图像以后端精细加载。但没有在网页上显示。
这是我的代码:
<figure class="c-card__image c-card__image--arrow c-searchresult__image"style="background-image: url('{{$image}}?{{\Carbon\Carbon::now()->timestamp}}')"></figure>
这是浏览器中的代码:
<figure class="c-card__image c-card__image--arrow c-searchresult__image" style="background-image: url('/vendors/57/horse-11.png?1554287941')"></figure>
在我的控制台和网络选项卡(从浏览器)我可以看到图像正确加载..但它没有显示在屏幕上..
在上面的代码中,你没有指定任何可能是问题的文件类型,它应该像这样的horse-11.png?1554287941.png
或horse-11?1554287941.png
.Your $image
var应该只保存名称,这样你可以做这样的事情:
<figure class="c-card__image c-card__image--arrow c-searchresult__image"style="background-image: url('{{$image}}?{{\Carbon\Carbon::now()->timestamp}}'.'png')"></figure>
输出将是这样的
<figure class="c-card__image c-card__image--arrow c-searchresult__image" style="background-image: url('/vendors/57/horse-11?1554287941.png')"></figure>