[php]代码库
'HTML_CACHE_ON' => true, //开启缓存
'HTML_CACHE_RULES' => array(
'Show:index' => array('{:module}_{:action}_{id}',60), //设置静态缓存规则 {:module}_控制器名称 {:action}方法 0为永久有效,没有失效
),
开启静态缓存会影响静态刷新,阅读的次数,解决方法(异步)
html:
<span class='fr'>已被阅读<script type="text/JavaScript" src='{:U(GROUP_NAME . "/Show/hits",array("id" => $blog["id"]))}'></script>次</span>
c:
public function clickNum() {
$id = (int) $GET_[''id];
$where = array('id' => $id);
$click = M('blog')->where($where)->getField('click');
M('blog')->where($where)->setInc('click);
echo 'document.write(' .$click . ')';
}