Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,有没有办法从存储在数据库中的字符串调用 smarty 插件或块?我试过 {eval} 效果很好,但我无法在字符串中选择的地方加载插件。
例子:
text {contact_form} text picture {register_form}
我得到:
text text picture {contact_form} {register_form}
您可以在模板代码前添加 'string:' 并将其传递给 fetch() 而不是实际的模板文件:
$tpl = <<<EOT text {contact_form} text picture {register_form} EOT; echo $smarty->fetch('string:' . $tpl);