在项目的Behavior目录下
建立CounterBehavior.class.php文件";
}
$content = str_replace('{__Counter__}',$pic,$content);
$hits++;
if(!session('?counter'))
{
$handle=fopen($file, "w");
flock($handle, LOCK_EX+LOCK_NB);
fwrite($handle, $hits);
flock($handle, LOCK_UN+LOCK_NB);
fclose($handle);
session('counter',time());
}
}
else
{
$content = str_replace('{__Counter__}','',$content);
}
}
}然后在需要使用计数器的模板文件里加上{__Counter__}即可
counter.zip
( 148.97 KB 下载:154 次 )
AD:真正免费,域名+虚机+企业邮箱=0元