如何显示在Laravel中有值的多列

问题描述 投票:1回答:1

我想显示具有价值的列。有些列的值有些没有。

我写了下面的代码。但这没用。您能教我如何写代码吗?

 @php
 if(!empty($image->wc)){
 echo "WC is ";  
 }
 @endphp
{{ $image->wc }} 

@php2
 if(!empty($image->w_type)){
 echo "W Type is :";  
 }
 @endphp2
{{ $image->w_type }} 
laravel
1个回答
1
投票

您可以尝试这个

@if(isset($image->wc))
    echo "WC is".{{$image->wc}};  
@endif
© www.soinside.com 2019 - 2024. All rights reserved.