的点击次数我要算一个链接的点击次数和发布的点击次数。我使用下面的代码,但它显示计数为0。我无法确定它在哪里的错误。然而,我可以猜测,“点击”没有正确实施..请亲切地帮助我。PHP显示一个链接
<?php
if(isset($_POST['clicks'])) {
incrementClickCount();
}
function getClickCount()
{
return (int)file_get_contents("clickcount.txt");
}
function incrementClickCount()
{
$count = getClickCount() + 1;
file_put_contents("clickcount.txt", $count);
}
?>
<html>
<head>
<title>Click Count</title>
</head>
<body>
<a href="http://www.google.com" name="clicks">Google</a>
</ br>
</ br>
<div>Click Count: <?php echo getClickCount(); ?></div>
</body>
</html>
是什么... O O 6-8 –
如果可能的话,用数据库做这件事可能会好很多。 – ShoeLace1291
@samankhademi我不明白你想说什么? –