|
|
Tutorials » Php »
|
Topic |
What is Setcookie Function?
|
|
Explanation |
|
The "setcookie" function is used to send a cookie.
Syntax:
setcookie(name,value,expire,path,domain,secure)
In the above syntax "name" specifies the name of the cookie, "value" specifies the value of the cookie,
"expire" specifies when the cookie expires, "path" specifies the server path of the cookie, "domain" specifies
the domain name of the cookie,"secure" specifes whether a cookie should be transmitted or not over a secure connection.
Example:
<?php
$value = "this cookie value";
setcookie("TestCookie",$value, time()+3600*24);
?>
In the above example a string is assigned to the cookie, and the cookie is set a expiry time of 24 hours.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|