Home  >  Article  >  Backend Development  >  Do you know something to note about the use of Php Cookies?

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

怪我咯
怪我咯Original
2017-07-05 10:33:401221browse

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;]); 
?>

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!

Statement:
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