标签:smarty 循环
smarty使用:
<?php $items_list = array( 23 => array(‘no‘ => 2456, ‘label‘ => ‘Salad‘), 96 => array(‘no‘ => 4889, ‘label‘ => ‘Cream‘) ); $smarty->assign(‘items‘, $items_list); ?> <ul> {foreach from=$items key=myId item=i} <li><a href="http://blog.163.com/lgh_2002/blog/item.php?id={$myId}">{$i.no}: {$i.label}</li> {/foreach} </ul> 上例将输出: <ul> <li><a href="http://blog.163.com/lgh_2002/blog/item.php?id=23">2456: Salad</li> <li><a href="http://blog.163.com/lgh_2002/blog/item.php?id=96">4889: Cream</li> </ul>
本文出自 “PHP程序猿” 博客,请务必保留此出处http://okowo.blog.51cto.com/4923464/1614122
标签:smarty 循环
原文地址:http://okowo.blog.51cto.com/4923464/1614122