Tags
Asked 3 years ago
13 Jul 2021
Views 165
Esmeralda

Esmeralda posted

What is Setcookie function in PHP ?

What is Setcookie function in PHP ?
jabber

jabber
answered Jul 21 '21 00:00

setcookie function will create cookie with given name and value and timeline

setcookie("login", 1);
setcookie("login", 1, time()+7200);   

setcookie("login", 1);
this code will set the cookie named 'login' and set value it to 1


setcookie("login", 1, time()+7200);
this code will do same job pervious one : the cookie named 'login' and set value it to 1 but it also stats that when this cookie expire which is time()+7200 , its 2 hour after it created .


Post Answer