Home >php教程 >php手册 >php记录上次与本次访问时间代码实例

php记录上次与本次访问时间代码实例

WBOY
WBOYOriginal
2016-06-13 10:38:441467browse

header(Content-Type:   text/html;   charset=utf-8);

if(!isset($_COOKIE["php_cookie"])){
        setcookie("php_cookie",date("Y-m-d H:i:s"));
        echo "欢迎你第一次访问网站";
        echo
;
}else{
        setcookie("php_cookie",date("Y-m-d H:i:s"),time() 60);
        echo "你上次访问网站的时间为: ".$_COOKIE["php_cookie"];
        echo
;
}


echo "你本次访问网站的时间为: ".date("Y-m-d H:i:s");

?>

  • 来源: 编程之家
  • 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