[英]How can i Display Json encoded data from a database column in laravel view blade
Am storing the image location url to my database column called images. 我将图像位置网址存储到名为images的数据库列中。 and the are in this form… [“ http://kizflex.local/properties/10.jpg ”,” http://kizflex.local/properties/11.jpg ”]
以这种形式... [“ http://tizflex.local/properties/10.jpg ”,“ http://kizflex.local/properties/11.jpg ”]
So how can i iterate through this particular column so as to get each address and display it in my view? 那么我如何遍历这个特定的列以获取每个地址并在我的视图中显示它? Please am stuck i need help.
请卡住我需要帮助。
@foreach($properties->all() as $property)
<h1>{{$property->property_title}}</h1>
@foreach (json_decode($property->property_image, true) as $image)
<img src="{{ $image[0] }}" alt="" width="100%">
@endforeach
@endforeach
@php $index=0; @endphp @for($i=0;$i < count($productDetails);$i++)
<div class="row">
<div class="col-lg-3 col-md-4 col-xs-5 thumb">
<a class="thumbnail"
href="{{url('route')}}"
style="box-shadow: 0px 1px 3px 3px #337ab724"> <img
src="{{asset($productDetails[$i]['path'])}}"
class="img-rounded">
</a>
</div>
</div>
@endfor
Your array only has one level, so $image
is a string. 您的数组只有一个级别,因此
$image
是一个字符串。 You need to replace {{ $image[0] }}
with {{ $image }}
. 您需要将
{{ $image[0] }}
替换为{{ $image }}
。
@foreach($properties->all() as $property)
<h1>{{$property->property_title}}</h1>
@foreach (json_decode($property->property_image, true) as $image)
<img src="{{ $image }}" alt="" width="100%">
@endforeach
@endforeach
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.