The Setcookie () function sends an HTTP cookie to the client. A cookie is a variable that is sent to the browser by the server. A cookie is usually a small text file that the server embeds into a user's computer. This cookie is sent whenever the computer requests a page through a browser.
The Setcookie () function sends an HTTP cookie to the client.
A cookie is a variable that is sent to the browser by the server. A cookie is usually a small text file that the server embeds into a user's computer. This cookie is sent whenever the computer requests a page through a browser.
The name of the cookie is specified as a variable of the same name. For example, if the cookie being sent is named "name", a variable named $user is automatically created, containing the value of the cookie.
The cookie must be assigned before any other output is sent.
If successful, the function returns True, otherwise false is returned.
Grammar
Setcookie (Name,value,expire,path,domain,secure)
*/
$cookieinfo =session_get_cookie_params (); Get cookie Information
if ((Empty ($cookieinfo [' domain ')) && (Empty ($cookieinfo [' secure ']))//Check whether the result is empty
{
Setcookie (Session_name (), ", Time () -3600, $cookieinfo [' path ']); Set cookies
}
ElseIf (Empty ($cookieinfo [' secure ')])//Check whether the option is empty
{
Setcookie (Session_name (), ", Time () -3600, $cookieinfo [' Path '], $cookieinfo [' domain ']); Set cookies
}
Else
{
Setcookie (Session_name (), ', Time () -3600, $cookieinfo [' Path '], $cookieinfo [' Domain '], $cookieinfo [' secure ']; Set cookies
}
Session_destroy (); Logout session
Print_r ($_session);
Print_r ($_cookie);
Use Session_set_cookie_params to set the lifetime and path
Session_set_cookie_params (0, '/yourpath/'); Set the lifetime and path of a cookie
/*
Note: You can access the value of a cookie named "User" by $http _cookie_vars["user"] or $_cookie["user".
Note: When a cookie is sent, the value of the cookie is automatically URL-encoded. The URL is decoded when it is received. If you don't need this, you can use Setrawcookie () instead.
*/
http://www.bkjia.com/PHPjc/631713.html www.bkjia.com true http://www.bkjia.com/PHPjc/631713.html techarticle the Setcookie () function sends an HTTP cookie to the client. A cookie is a variable that is sent to the browser by the server. A cookie is usually a small text file that the server embeds into a user's computer. Every ...