Cookies in PHP





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


Removing Cookies


<?php
// Deleting a cookie
setcookie("username", "", time()-3600);
?>
Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment