Cookies aren't persisting in PHP?

后端 未结 4 742
Happy的楠姐
Happy的楠姐 2021-01-27 03:24

How do I get the cookies to persist in php?


give_cookie.php



        
4条回答
  •  情书的邮戳
    2021-01-27 03:59

    i think the time you are setting is still in the past

    currently

    time() = 1348584550
    
    100 * 60 * 60 * 24 * 30 =  259200000
    

    so try

    setcookie("muffin", "55", time() + (100 * 60 * 60 * 24 * 30));
    
    if($_COOKIE["muffin"])
        echo "open";
    

提交回复
热议问题