商店图片的控制器代码
$data = new Data;
if ($request->hasFile('image')) {
$fileName = $request->image->getClientOriginalName();
$request->image->storeAs('/images', $fileName);
$data->image = $fileName;
$data->save();
}
刀片
<td>
<img height="100" width="200" src="images/{{ $item['image'] ? $item->image : 'http://placehold.it/400x400' }} " alt="">
</td>
浏览器控制台
答案 0 :(得分:0)
像下面一样替换src
src =“ {{asset('storage'}}} / images / {{$ item ['image']?$ item-> image:'http://placehold.it/400x400'}}”