Posts Tagged ‘Cookies’

Setting Cookies

Tuesday, March 11th, 2008

Problem
You want to set a cookie.
Solution
Use setcookie():

setcookie('flavor','chocolate chip');

Discussion
Cookies are sent with the HTTP headers,so setcookie() must be called before any
output is generated. You can pass additional arguments to setcookie() to control cookie behavior. The
third argument to setcookie() is an expiration time,expressed as an epoch timestamp.
(more…)