Thursday, 8 August 2013

PHP Setting HTTP Cookie

PHP Setting HTTP Cookie

I want to add a cookie using PHP to the browser which the expiration date
is one year after the cookie is set. I have set the variable
name,value,path "/",domain and the expiry date. However, when I close the
browser and open the website again using the same browser, no cookies are
sent to the web page. What happened? The cookie is still applicable if I
only close the window only. Yet things happened when the application is
shut down and opened again.
setcookie("LANG","english",time()+365*60*60*24,"/","sub.domain.org");

No comments:

Post a Comment