您好,欢迎访问一九零五行业门户网

smarty 在设定关了cache 能不能在指定的文件用cache?该如何解决

smarty 在设定关了cache 能不能在指定的文件用cache?
做了个小function, online_count(), 显示在线人数, 中间技术不说,因为这是一个小项目上用的,准确度要求不高,但是必须要显示
$smarty -> assign(online_count,online_count());
我不想每次都去查问这个统计在线人数的function online_count();
在config 中已设定了
我的config.php
$smarty = new smarty();
//.......跳过
$smarty -> caching = 0;
//在线人数
$smarty -> assign(online_count,online_count());

请问还有可能把online_count这变量设定为cache吗?
为什么要把这个放到config.php赋值? 
因为我在线人数显示在header  而header没有php,只有模版,也没有任何php  $smarty -> display()  这个header.html模板
都是在其他模板引入的            {include file=common/header.html}
请问还有什么方法?
先不理这在线人数要cache起来的要求是否无理,在技术的层面能有什么方法解决吗?
------解决思路----------------------
可以在online_count這個function中做cache。
其它类似信息

推荐信息