亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Introduction to cookies

Cookies are data stored in the client's browser. We use cookies to track and store user data. Typically, cookies are returned from the server to the client via HTTP headers. Most web programs support the operation of cookies. Because cookies exist in the HTTP header, they must be set before other information is output, similar to the usage restrictions of the header function.

PHP sets Cookie through the setcookie function. Any Cookie sent back from the browser will be automatically stored in the global variable of $_COOKIE by PHP, so we can use $_COOKIE['key' ] to read a cookie value.

Cookies in PHP are very widely used and are often used to store users' login information, shopping carts, etc. When using a Session, Cookies are usually used to store session IDs to identify users. Cookies have a validity period. When the validity period expires, the cookie will be automatically deleted from the client. At the same time, for security control, Cookie can also set domain and path. We will explain them in detail in later chapters.


Continuing Learning
||
<?php setcookie('test', time()); ob_start(); print_r($_COOKIE); $content = ob_get_contents(); $content = str_replace(" ", ' ', $content); ob_clean(); header("content-type:text/html; charset=utf-8"); echo '當(dāng)前的Cookie為:<br>'; echo nl2br($content); ?>
submitReset Code