答案 0 :(得分:6)
如果您已经通过smarty分配了现有阵列,那么您可以使用smarty foreach循环访问键和值。
{foreach from=$array key="key" item="value"}
{$key} => {$value}
{/foreach}
答案 1 :(得分:1)
$country=array('INDIA','United State');
$smarty->assign('country',$country);
Then you can use like
{$country[0]}
{$country[1]}
$country=array('IND'=>INDIA','US'=>'United State');
$smarty->assign('country',$country);
Then you can use Something Like This
{$country.IND}
{$country.US}
答案 2 :(得分:-2)
$myarray['mykey'] = 'myvalue';
$smarty->assign('myarray', $myarray);
The value is: <strong>{$myarray.mykey}</strong>
我会说你可以找到所有这些,只需查看文档。