php-cookie-php Cannot delete cookies

Source: Internet
Author: User
Keywords Php-cookie php cookie
Tags set cookie

$cookie retention Time
$falg User Unique identifier
$name User Name
Set Cookie Information
function _setcookie ($name, $flag, $time)
{

switch($time){    case 0:        setcookie('username',$name);        setcookie('userflag',$flag);        _alert_location('登录成功', 'index.php');        break;    case 1:        setcookie('username',$name,time()+86400);        setcookie('userflag',$flag,time()+86400);        _alert_location('登录成功', 'index.php');        break;    case 2:        setcookie('username',$name,time()+604800);        setcookie('userflag',$flag,time()+604800);        _alert_location('登录成功', 'index.php');        break;}

}
?>

IE and Firefox can not delete what is the reason ah?

Setcookie ("username", "", Time ()-1);
Setcookie ("Userflag", "", Time ()-1);

That's not true.

I've solved the problem of path.
Setcookie ("username", "", Time ()-1, '/my_dome%201.0/');
This looks good ~ but it's strange that when the local debugging why add '/my_dome%201.0/' can not be '/'? How to modify the website after the official launch?

More depressed is under the Firefox and IE under the path is not the same ~
Setcookie ("username", "", Time ()-1, '/my_dome%201.0/'); How to delete under Firefox
Setcookie ("Userflag", "", Time ()-1, '/my_dome%201.0/');
Setcookie ("username", "", Time ()-1, '/my_dome%201.0 '); How to delete under IE
Setcookie ("Userflag", "", Time ()-1, '/my_dome%201.0 ');

There is no good way to solve this problem ~

Reply content:

$cookie retention Time
$falg User Unique identifier
$name User Name
Set Cookie Information
function _setcookie ($name, $flag, $time)
{

switch($time){    case 0:        setcookie('username',$name);        setcookie('userflag',$flag);        _alert_location('登录成功', 'index.php');        break;    case 1:        setcookie('username',$name,time()+86400);        setcookie('userflag',$flag,time()+86400);        _alert_location('登录成功', 'index.php');        break;    case 2:        setcookie('username',$name,time()+604800);        setcookie('userflag',$flag,time()+604800);        _alert_location('登录成功', 'index.php');        break;}

}
?>

IE and Firefox can not delete what is the reason ah?

Setcookie ("username", "", Time ()-1);
Setcookie ("Userflag", "", Time ()-1);

That's not true.

I've solved the problem of path.
Setcookie ("username", "", Time ()-1, '/my_dome%201.0/');
This looks good ~ but it's strange that when the local debugging why add '/my_dome%201.0/' can not be '/'? How to modify the website after the official launch?

More depressed is under the Firefox and IE under the path is not the same ~
Setcookie ("username", "", Time ()-1, '/my_dome%201.0/'); How to delete under Firefox
Setcookie ("Userflag", "", Time ()-1, '/my_dome%201.0/');
Setcookie ("username", "", Time ()-1, '/my_dome%201.0 '); How to delete under IE
Setcookie ("Userflag", "", Time ()-1, '/my_dome%201.0 ');

There is no good way to solve this problem ~

See if path and domain are written incorrectly.

  • 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.