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

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

WBOY
Release: 2016-06-13 10:38:44
Original
1465 people have browsed it

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");

?>

  • 来源: 编程之家
  • source:php.cn
    Statement of this Website
    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
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template