1、文件结构php
2、配置文件 init.inc.php
缓存
/**ui
file: init.inc.php Smarty对象的实例化及初始化文件spa
*/插件
define ("ROOT",str_replace('\\','/',dirname(__FILE__)).'/'); //指定项目的根路径对象
require ROOT.'libs/Smarty.class.php'; //加载Smarty类文件it
$smarty = new Smarty(); //实例化Smarty类的对象$smarty编译
/*使用Smarty3的设置默认的路径*/模板
$smarty ->setTemplateDir(ROOT.'templates/'); //设置模板文件class
$smarty ->setCompileDir(ROOT.'templates_c/'); //设置全部编译过的模板文件存放的目录
$smarty ->setPluginsDir(ROOT.'plugins/'); //设置为模板扩充插件存放目录
$smarty ->setCacheDir(ROOT.'cache/'); //设置缓存文件存放的目录
$smarty ->setConfigDir(ROOT.'configs/'); //设置模板配置文件存放的目录
$smarty ->caching = false; //设置Smarty缓存开关
$smarty ->cache_lifetime = 60*60*24; //设置模板缓存有效时间的长度为1天
$smarty ->left_delimiter = '<{'; //设置模板语言中的左结束符
$smarty ->right_delimiter = '}>'; //设置模板语言中的右结束符