Today, the PHP cookie must be refreshed and the problem can be resolved as follows:
PHP cookie setting function takes effect immediately, supports array
function Cookie ($var, $value = ', $time = 0, $path = ', $domain = ', $s = false)
{
$_cookie[$var] = $value;
if (Is_array ($value)) {
foreach ($value as $k = = $v) {
Setcookie ($var. ' ['. $k. '] ', $v, $time, $path, $domain, $s);
}
} else {
Setcookie ($var, $value, $time, $path, $domain, $s);
}
}
This will not be refreshed, directly can get the value of the cookie, cookie parameter details see PHP manual
Tips:
In fact, in this code for cookies in time to update the effect of these two sentences:
$_cookie[$var] = $value;
Setcookie ($var, $value, $time, $path, $domain, $s);
That is, the cookie was assigned two times at a time.
Original address: http://www.cnblogs.com/loveyouyou616/archive/2012/11/22/2782512.html
The above is introduced in PHP in a timely manner, without refresh can be used, including the content of the cookie,php, I hope that the PHP tutorial interested in a friend helpful.