【发布时间】:2018-04-29 18:41:41
【问题描述】:
我尝试使用
$template = "<h1>Hello {name},</h1>";
$smarty->assign('name','Christian');
$output = $smarty->fetch('string:' . $template);
echo $output;
结果是:
Hello ,
它输出模板,但不显示模板中的变量。我用的是最新的Smarty 3.1.32 什么问题 谢谢Christian的帮助
【问题讨论】:
-
根据smarty.net/docs/en/language.function.assign.tpl 看来您在
{name}中缺少$。
标签: php html templates smarty smarty3