How to set cookies?
setcookie('variable','value','time');
variable - Name of the cookie variable
value - Value of the cookie variable
time - Expiry time;
Example: setcookie('Test',$i,time()+3600);
Test - cookie variable name
$i - value of the variable 'Test'
time()+3600 - Cookie will expire after one hour.
How to reset/destroy a cookie?
Reset a cookie by specifying expire time in the past:
Example: setcookie('Test',$i,time()-3600); // already expired time
Reset a cookie by specifying its name only
Example: setcookie('Test');
Default session time in php?
The default session time in php is until closing of browser.
How to get the value of current session id?
session_id() returns the session id for the current session.
No comments:
Post a Comment