A cookie is a small piece of information sent between the server and the client, which is the most frequent web brower, you can instruct web browers to save your information and retrieve it later from the browser. This lets you save information about your visitors, for example preferences or statistical information. A very common use of cookies is to see if a particular person has to go to the site within a fixed time on the site, whether it is a new visitor or returning visitor Should be counted or not. Such information is used for data, for example, a counter.
Syntax -
setcookie(name, value, expire, path, domain, secure);
setcookie("user_name", "John Doe");
echo $_COOKIE["user_name"];
Cookies Values -
<?php
// Accessing an individual cookie value
echo $_COOKIE["username"];
?>
// Accessing an individual cookie value
echo $_COOKIE["username"];
?>
Removing Cookies
<?php
// Deleting a cookie
setcookie("username", "", time()-3600);
?>
// Deleting a cookie
setcookie("username", "", time()-3600);
?>
0 comments:
Post a Comment