时间:2021-07-01 10:21:17 帮助过:22人阅读
$smarty = new Sys_SmartyWork(CRON_HOME."/modifyInfo/tpl",CRON_HOME."/modifyInfo/tpl_c"); $hash = array();$info = array();$info ['smarty'] = 'i am smarty!';$info ['php'] = 'i am php';$hash['arrInfo'] = $info;//进行模板变量替换 $smarty->assign($hash); //编译并显示位于./templates下的index.htm模板 $msg = $smarty->display('test.tpl');
{{$arrInfo.smarty}}------------{{ php }} //php给smarty变量赋值 $this->_tpl_vars['name'] = 'hello world!'; {{/php}}{{$name}}