配置smarty模板文件夹路径时出现问题:
Smarty: Unable to load template file 'login.tpl'
原先使用原先配置命令:
$smarty->template_dir="../templates/";
输出路径,
foreach ($smarty->template_dir as $key => $value) {
# code...
echo "--$value";
}
发现配置路径命令没起作用。
原因:在Smarty 3.1之后,$template_dir属性不能直接访问,需使用 getTemplateDir(), setTemplateDir() 和addTemplateDir()来进行存取。
解决方法:$smarty->setTemplateDir("../templates/");
成功!