问题描述
|
致命错误:消息\'Syntax Error in 9 \“ Ola上的模板\” C:\ xampp \\ htdocs \\ eventos \\ libs \\ templates \\ teste.tpl \“中未捕获的异常\'SmartyCompilerException \' !{$ names},Bim Vindo ao Smarty!\“ C:\\ xampp \\ htdocs \\ eventos \\ libs \\ sysplugins \\ smarty_internal_templatecompilerbase.PHP:441中的未知标记\” private_print_expression \“ \' #0 C:\\ xampp \\ htdocs \\ eventos \\ libs \\ sysplugins \\ smarty_internal_templatecompilerbase.PHP(263):Smarty_Internal_TemplateCompilerBase-> trigger_template_error(\'unkNown tag \“ pr ... \',9)#1 C:\\ xampp \\ htdocs \\ eventos \\ libs \\ sysplugins \\ smarty_internal_templateparser.PHP(2338):Smarty_Internal_TemplateCompilerBase-> compileTag(\'private_print_e ... \',Array,Array)#2 C:\\ xampp \\ htdocs \\ eventos \\ libs \\ sysplugins \\ smarty_internal_templateparser.PHP(2846):Smarty_Internal_Templateparser-> yy_r28()#3 C:\\ xampp \\ htdocs \\ eventos \\ libs \\ sysplugins \\ smarty_internal_templateparser.PHP(2846) .PHP(2946):Smarty_Internal_Templateparser-> yy_reduce(30)#4 C:\\ xa mpp \\ htdocs \\ eventos \\ libs \\ sysplugins \\ smarty_internal_smartytemplatecompiler.PHP(51):在C:\\ xampp \\ htdocs \\ eventos \\ libs \\ sysplugins \\ smarty_internal_templatecompilerbase.PHP中智能
我的PHP代码
<?PHP
include(\'includes/header.html\');
include(\'conf/conf.PHP\');
require_once(SMARTY_DIR.\'Smarty.class.PHP\');
$smarty = new Smarty();
$smarty->template_dir = \'C:\\xampp\\htdocs\\eventos\\libs\\templates\';
$smarty->compile_dir = \'C:\\xampp\\htdocs\\eventos\\libs\\templates_c\';
$smarty->config_dir = \'C:\\xampp\\htdocs\\eventos\\libs\\configs\';
$smarty->cache_dir = \'C:\\xampp\\htdocs\\eventos\\libs\\cache\';
$smarty->assign(\'name\',\'Ned\');
$smarty->display(\'teste.tpl\');
?>
和我的智能代码(teste.tpl)
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<Meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Untitled Document</title>
</head>
<body>
Ola! {$name},bem vindo ao Smarty!
</body>
</html>
解决方法
更改
$smarty->assign(\'name\',\'Ned\');
至
$smarty->assign(\'names\',\'Ned\');