我登录时有一个登录页面,进程页面设置了一个 cookie,我想下次使用这个 cookie 自动登录。Cookie 设置在浏览器上,我可以看到它,但是当我想在登录页面上使用它时,cookie 为空(浏览器仍然有它,我可以看到它)浏览器:mozilla目录:index.php (login page) --> in root /include-function --> /functions/include-function.phpform-process.php --> /functions/form-process.php我打开了 php.ini 的输出缓冲注意:这篇文章在回答后编辑这是我的登录页面:<?phprequire("./functions/include-function.php"); ?><html dir="ltr"><head><meta charset="utf-8"><link rel="stylesheet" href="./style/form.css"><script type="text/javascript"src="./js/form.js"></script><title></title></head><body><div class="wrapper"><div class="container"> <h1>Welcome</h1> <form class="form" method="get" action="./functions/form-process.php"> <input type="text" placeholder="Username" name="username"> <input type="text" placeholder="Username" name="username" value="<?php print_r($_COOKIE); ?>"> <input type="password" placeholder="Password" name="password"> <button type="submit" id="login-button" name="submit" value="submit">Login</button> </form> </div> <ul class="bg-bubbles"> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> </body> </html>这是我的流程页面:<?php require("./include-function.php"); ?><?phpif (isset($_GET['submit'])) {$username = $_GET['username'];$pass = $_GET['password'];$message = validation_form($_GET);$value = 45;$cookieName = "us";if ($username == "vahid@gmail.com" && $pass == "123456" && empty($message)) { $expired = time() + (60 * 60 * 24 * 1); setcookie($cookieName,$value,$expired); // redirect_to("http://www.youtube.com/"); print_r($_COOKIE);}else{ redirect_to("../index.php");}}?>
1 回答
- 1 回答
- 0 关注
- 147 浏览
添加回答
举报
0/150
提交
取消