top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How the cookie can be set and destroyed in PHP?

+1 vote
270 views
How the cookie can be set and destroyed in PHP?
posted May 21, 2014 by Karamjeet Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

By Using
setcookie(name,value,expire,path,domain);
function ,you can set the cookies in PHP.
e.g. setcookie("user","xyz",time()+3600) ;
The above written function will set the cookie.

For Destroying the cookie, you should set the cookie in past.
e.g. setcookie("user","xyz",time()-3600);

answer May 22, 2014 by Mohit Sharma
...