首页 > 解决方案 > 我想将一个数组从 php 文件发送到 smarty 中的 .tpl 文件

问题描述

当我尝试在 php 文件中使用 $smarty->assign('data',$data) 并尝试在我的 tpl 中写入 {$data} 它得到 Null 如何使 tpl 文件正确读取值

标签: phpsmarty

解决方案


尝试:

{foreach from=$data item=foo}
{$foo.myitem}
{/foreach}

{foreach},{foreachelse}


推荐阅读