Smarty 模板 -- 从php分配的变量

xiaoxiao2021-03-01  15

index.php: $smarty = new Smarty; $smarty->assign('Contacts', array('555-222-9876', 'zaphod@slartibartfast.com', array('555-444-3333', '555-111-1234'))); $smarty->display('index.tpl'); index.tpl: {$Contacts[0]}<br> {$Contacts[1]}<br> {* you can print arrays of arrays as well *} {$Contacts[2][0]}<br> {$Contacts[2][1]}<br> OUTPUT: 555-222-9876<br> zaphod@slartibartfast.com<br> 555-444-3333<br> 555-111-1234<br> 相关资源:PHP模板引擎Smarty中变量的使用方法示例
转载请注明原文地址: https://www.6miu.com/read-3349971.html

最新回复(0)