目前我正在使用Smarty引擎。现在,我想在模板文件中添加一点点PHP代码,如下所示:
{php}echo "asdf";{/php}但是,当我打开浏览器时,会出现以下错误:
致命错误:模板中带有消息‘语法错误’的未命名异常'SmartyCompilerException‘
问题是什么,我该怎么解决呢?
发布于 2012-12-20 16:05:51
{php}echo("Hello, world!");{/php}也许这能代替?
发布于 2012-12-20 16:09:47
{php}
// including a php script directly from the template.
include('/path/to/display_weather.php');
{/php}这样,您就可以将php代码嵌入到智能模板文件中。请检查此以供参考,http://www.smarty.net/docsv2/en/language.function.php.tpl
https://stackoverflow.com/questions/13975978
复制相似问题