简体   繁体   中英

I want to send an array from php file to .tpl file in smarty

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

Try:

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

{foreach},{foreachelse}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM