Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel 为什么图像不显示在会议详细信息页面中?_Laravel - Fatal编程技术网

Laravel 为什么图像不显示在会议详细信息页面中?

Laravel 为什么图像不显示在会议详细信息页面中?,laravel,Laravel,在页面中有一个类似于以下内容的img: <img src="{{ $conference->image == null ? '/img/5.png' : $conference->image }}" 然后图像就出现了。生成的src类似于 但在“会议详细信息”页面中,还使用: <img src="{{ $conference->image == null ? '/img/5.png' : $conference->image }}" 图像不会出现。生成的sr

在页面中有一个类似于以下内容的img:

<img src="{{ $conference->image == null ? '/img/5.png' : $conference->image }}"
然后图像就出现了。生成的src类似于

但在“会议详细信息”页面中,还使用:

<img src="{{ $conference->image == null ? '/img/5.png' : $conference->image }}"

图像不会出现。生成的src类似于。

尝试将代码更改为

<img src="{{ $conference->image == null ? url('img/5.png') : url($conference->image) }}"

使用该函数生成图像的正确路径。

尝试如下更改代码:

<img src="/{{ $conference->image or 'img/5.png' }}" />

谢谢,但是在本例中没有$confernece->image,因此应该显示image 5.png。您的img/5.png是否在/public文件夹中?是的,在public/img/5.png中。同样的,请使用url'img/5.png'谢谢,但不要显示image==null?url'img/5.png':$conference->image}}class=img fluid/>。