Set cookie expire end session and domain?

How can I set a cookie that will expire at the end of the session and add domain name to the cookie parameters?

http://php.net/manual/en/function.setcookie.php

expire
The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you’ll most likely set this with the time() function plus the number of seconds before you want it to expire. Or you might use mktime(). time()+606024*30 will set the cookie to expire in 30 days. If set to 0, or omitted, the cookie will expire at the end of the session (when the browser closes).

1 Like

Thanks buddy I can set a cookie to expire at the end of the session but can’t add domain name to it please help.

setcookie("test", $value);

Please read the linked documentation. It explains in detail which parameter does what (and which is the one for domain names).

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.