smarty开启缓存后第一次刷页面乱码,再刷一次就正常了,工程和页面都是utf8编码,不知道***问题。
PHP代码如下(smarty3.1.16)
<?php
include_once './libs/Smarty.class.php';
$smarty = new Smarty();
$smarty->caching =1;
$smarty->cache_lifetime =3 ;
$smarty->assign("name","万事如意");
$smarty->display("name.html");
模版
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
{$name}
</body>
</html>