Cookie display question & lt ;? Php & nbsp; setcookie (user, & nbsp; Alex & nbsp; Porter, & nbsp; time () + 3600); echo & nbsp; $ _ COOKIE [user];? & Gt; you can obtain the value only after refreshing the page. Is there any way to solve this problem? ------ Solve the issue of displaying cookies
Setcookie ("user", "Alex Porter", time () + 3600 );
Echo $ _ COOKIE ["user"];
?>
The page must be refreshed to obtain the value. Is there any way to solve this problem?
------ Solution --------------------
The problem is that it is meaningless. if you really want to change it to $ _ SESSION
------ Solution --------------------
The landlord should understand the principle of sending cookies.
When a browser sends a request like a server, the browser will send the client's cookie information over http.
The server can only obtain this cookie before it can echo.