时间:2021-07-01 10:21:17 帮助过:38人阅读
// 访客计数器函数
function counter() {
!empty($_GET['weburl']) || die('weburl不能为空');
$weburl = $_GET['weburl'];
$file = '/usr/local/apache/htdocs/MyTests/counter.txt';
if (! file_exists($file)) {
$num = 1;
$cf = fopen($file, 'w');
fwrite($cf, $weburl.' '.$num);
fclose($cf);
} else {
$cf = fopen($file, 'rw');
$num = fgets($cf);
$num = substr($num, 15);
fclose($cf);
++$num;
$cf = fopen($file, 'w');
fwrite($cf, $num);
fclose($cf);
}
}
?>
访客计数器
欢迎访问
您是第位访客
// 访客计数器函数
function counter() {
!empty($_GET['weburl'])
------解决方案--------------------
die('weburl不能为空');