smarty 配置问题

来源:互联网 发布:sai软件入门教程 编辑:程序博客网 时间:2024/06/18 13:26

smarty 配置问题
这里写图片描述

<?phprequire_once 'Smarty.class.php';$smarty = new Smarty();/** * Smarty 的配置口诀 */$smarty->left_delimiter = "{"; // 左定界$smarty->right_delimiter = "}"; // 右定界$smarty->template_dir = "tpl"; // html模板的地址$smarty->compile_dir = "templates_c"; // 设置编译目录$smarty->cache_dir = "cache"; //缓存文件夹//以下是开启缓存的另外两个配置//$smarty->caching=true;//开启缓存//$smarty->cache_lifetime120;//缓存时间$smarty->assign('articletitle','文章标题');$smarty->display("test.tpl");?>

目录结构如下
目录结构如下

解决办法:
如上仔细查看代码发现是配置smarty的 模板地址时路径错误,修改smarty>templatedir="tpl"smarty->template_dir = “../tpl”;即可!

原创粉丝点击