A cookies is a variable set on server normally used to identify
a user. A cookie is a small file that
the server embeds on the user's computer. Each time the same computer requests
a page with a browser, it will send the cookie too. A cookie can only be read
from the domain that it has been issued from.
Syntax
setcookie(name, value, expire, path, domain, secure, httponly);
- Name: It is used to set the name of the cookie.
- Value: It is used to set the value of the cookie.
- Expire: It is used to set the expiry timestamp of the cookie after which the cookie can’t be accessed.
- Path: It is used to specify the path on the server for which the cookie will be available.
- Domain: It is used to specify the domain for which the cookie is available.
- Security: It is used to indicate that the cookie should be sent only if a secure HTTPS connection exists.