Home  >  Article  >  Backend Development  >  PHP uses cookies to implement visit count statistics code_PHP tutorial

PHP uses cookies to implement visit count statistics code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:30:111168browse

[/code]
global $count;
$count=1;
if(!isset($_COOKIE["visittime"])){ setcookie("visittime", date("y-m-d H:i:s"));
setcookie("visitcount",1); echo "Welcome to your first visit to the website!";
}
else{
setcookie ("visittime",date("y-m-d,H:i:s"),time()+60); $count=$_COOKIE['visitcount']+1;
setcookie("visitcount",$count) ; echo "The time you last visited the website was:".$_COOKIE['visittime'];
echo "
";
}
echo "Your first".$_COOKIE[' visitcount']."The time of visiting the website is:".date("y-m-d H:i:s");
?>
[/code]

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323304.htmlTechArticle[/code] ?php global $count; $count=1; if(!isset($_COOKIE[" visittime"])){ setcookie("visittime",date("y-m-d H:i:s")); setcookie("visitcount",1); echo "Welcome to your first visit to the website!...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn