Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不明白我的错误在哪里:
页面a.php:
a.php
setcookie("user",$username,time()+300);
页面b.php:
b.php
echo $_COOKIE['user'];或者echo $_COOKIE["user"];
echo $_COOKIE['user'];
echo $_COOKIE["user"];
结果是echo什么都不打印!
echo
非常感谢你的帮助!
要么$username没有价值,要么在设置 cookie 之前有空格。必须在发送任何 HTML 之前将 Cookie 与标头信息一起发送,因此请确保
$username