include 'libs/Smarty/Smarty.class.php';
$smarty=new Smarty();
// 左定界符
$smarty->left_delimiter='{';
// 右定界符
$smarty->right_delimiter='}';
// 模板目录
$smarty->template_dir='tpl';
// 编译文件目录
$smarty->compile_dir='template';
// 缓存目录
$smarty->cache_dir='cache';
// 开启缓存
$smarty->caching=true;
// 缓存时长
$smarty->cache_lifetime=3600;
$smarty->assign('title','this is a title');
$smarty->display('index.tpl');
本文介绍了Smarty模板引擎的基本配置方法,包括设置定界符、指定模板目录、编译文件目录及缓存目录,同时开启了缓存功能并设置了缓存时长。通过实例展示了如何赋值变量并在模板中显示。
1040

被折叠的 条评论
为什么被折叠?



