【发布时间】:2016-10-12 05:38:47
【问题描述】:
我尝试使用 if 条件添加最后一项逻辑,但代码正在显示。
我现有的代码:
<script type='application/ld+json'>
{
"itemListElement":
[
@foreach($product->Offers as $offer)
{
"@type": "Offer",
"name": "{{$offer->title}}",
"price": "{{$offer->displayPrice}}",
},
@endforeach
]
}
}
</script>
【问题讨论】:
-
将 json_result 存储为对象并像这样使用它 - json_result.TrimEnd(',')