因此,我正在编写此代码,以便如果您是第一个点击链接的人,您要么被转发到某个页面,要么如果您不是初学者,则在显示一条消息后将您发送回原始页面我犯错了吗?
<?php
$count = file_get_contents('counter.txt');
$count = trim($count);
if ($count="0")
{
$count = $count + 1;
$fl = fopen("counter.txt","w+");
fwrite($fl,$count);
fclose($fl);
header("Location: newpage.html");
}
else
{
fclose($fl);
echo "Sorry but the item has already been sold out";
header("Location: oldpage.html");
}
?>