PHP cookies take effect in time, you can use PHP cookies to log in PHP to empty cookies without refreshing php how to set Cooki

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.