How to connect user with a login cookie in PHP?

前端 未结 2 2032
春和景丽
春和景丽 2020-12-05 01:32

First of all, I am testing on localhost. I have this index.php file which contains the following \"remember me\" checkbox:



        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 02:07

    reason behind your code is not working is

      setcookie("rememberme", $email . "," . $key, $timenow); // this is getting expire exactly at same time when it is set
    

    replace it with

     setcookie("rememberme", $email . "," . $key, time() * 3600);//expire after 1hour 
    

提交回复
热议问题