<?php
/*PHP模板引擎Smarty缓存应用
*/
require_once '../include/Smarty_inc.php';
//打开缓存功能
$smarty->caching=false;
//设置缓存目录
$smarty->cache_dir="../smarty_cache";
//设置缓存保存的时间,过了时间就刷新,?之内不刷新缓存
$smarty->cache_lifetime=60;//60s
$val=["Java", "PHP", "C++", "Python", "Javascript"];
$smarty->assign("arr", $val);
//$id=$_GET["id"];
$smarty->display("test4.html");
//清除指定id号的某一个页面的缓存
//$smarty->clearCache("test4.html", $id);
//清除缓存文件夹下所有的缓存文件
$smarty->clearAllCache();
//insert的使用,不被缓存,例如时间就是实时变化的,所以可以使用这个
function insert_getDate()
{
return date("Y-m-d H:m:s");
}
?>