Do you know something to note about the use of Php Cookies?

怪我咯
Release: 2023-03-12 18:24:01
Original
1193 people have browsed it

One thing that needs to be noted here is that in php, if you set COOKIE on the current page, before the current page is refreshed or redirected to other pages, the cookie The setting result will not take effect (if the cookie has not expired).

The code is as follows:

<?php 
setcookie(&#39;test&#39;, &#39;this is a cookie test&#39;); 
echo ($_COOKIE[&#39;test&#39;]); 
?>
Copy after login

The above code will not display the results you want

The above is the detailed content of Do you know something to note about the use of Php Cookies?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!