我有这样的数组
{
"sCode":"05",
"sCodeName":"critical_tight_connection",
"iSeverity":1,
"aData":{
"iLevelOfDetailt":2,
"iDuration":35,
"sLabel":"Labai trumpas pers\u0117dimas, 35 min.",
"sLink":""
}
}
我正在用 smarty 打印他(数组未序列化,我已经为您的方便做了)
{if !empty( $aSegment.aNotices.aStop )}
<ul>
{foreach from=$aSegment.aNotices.aStop item=aNotice}
<li>
<img class="{$aNotice.sCodeName}" />
{$aNotice.sLabel}
</li>
{/foreach}
</ul>
{/if}
如果 aNotices.aStop.sCode 中存在“05”,如何使用 smarty 检查?(在 foreach 循环之前)
试过这个
{if in_array('05', $aSegment.aNotices.aStop)}
exist
{/if}