当前位置: 首页 > 未分类>阅读正文

smarty生成编译后的html

2022.8.12 朱丰华 4228 次 留下评论 208字

使用 fetch 方法,生成编译后的html 。

除了不会直接输出以外,其他功能和 display 相同。

可以使用 fetch 方法动态替换字符串。


$bp3_Tag->assign("name", "测试123");

$html = $bp3_Tag->fetch(BP3_ROOT. '/test.html');

已知 test.html 模板中存在 $name ,此时先 assign(“name”,xx) 再 fetch ,则取得替换后的 html 字符串。

本篇完,还有疑问?留下评论吧

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注