foreach 遍历单个字段
pro_category 字段的内容"张三,李四,王五"。
{foreach from=','|explode:$data3["pro_category"] item=v}{$v}<br>{/foreach}
通过php函数explode,将,分割成数组,然后遍历输出。
foreach 遍历记录
{foreach key=k item=v from=$data5}<p>{$k+1}. {$v['up_name']} [<a target="_blank" href="{$v['up_url']}">预览</a>]</p>{/foreach}
section循环
{section name=v loop=$data} <div class="layui-col-md12"><input type="checkbox" name="" class="class_one" lay-filter="class_one" title="{$data[v].user_name}({$data[v].user_work})" lay-skin="primary" value="{$data[v].user_phone}" {if in_array({$data[v].user_phone},$pieces)}checked{/if}></div> {/section}
@lockdata.cn