我用来在用户登录时设置cookie
$a = setcookie($this->remCookieName,$cookie, time() + $this->remTime, '/', 'domain.com');
$b = setcookie($this->remCookieName,$cookie, time() + $this->remTime, '/', 'www.domain.com');
$c = setcookie($this->remCookieName,$cookie, time() + $this->remTime, '/', '.domain.com');
但我无法删除cookie
我试过
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', '.domain.com',true);
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'domain.com',true);
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'www.domain.com',true);
setcookie($this->remCookieName,'',mktime(12,0,0,1, 1, 1990), '/', 'test.domain.com',true);
setcookie($this->remCookieName,'',mktime(12,0,0,1, 1, 1990), '/', '.www.domain.com',true);
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', '.domain.com',false);
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'domain.com',false);
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'www.domain.com',false);
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'test.domain.com',false);
setcookie($this->remCookieName,'',mktime(12,0,0,1, 1, 1990), '/', '.www.domain.com',false);
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', '.domain.com');
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'domain.com');
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'www.domain.com');
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990), '/', 'test.domain.com');
setcookie($this->remCookieName,'',mktime(12,0,0,1, 1, 1990), '/', '.www.domain.com');
setcookie($this->remCookieName,'', mktime(12,0,0,1, 1, 1990));
setcookie($this->remCookieName,NULL,mktime(12,0,0,1, 1, 1990));
unset($_COOKIE[$this->remCookieName]);
但我无法删除我的cookie
如果我像这样设置安全cookie
$a = setcookie($this->remCookieName,$cookie, time() + $this->remTime, '/', 'domain.com',TRUE);
$b = setcookie($this->remCookieName,$cookie, time() + $this->remTime, '/', 'www.domain.com',TRUE);
$c = setcookie($this->remCookieName,$cookie, time() + $this->remTime, '/', '.domain.com',TRUE);
我可以删除但是如果用户在domain.com中加入并加入www.domain.com他没有登录
或者他在www.domain.com上,他没有登录domain.com
他登录www.domain.com或domain.com,我想用户登录www.domain.com和domain.com
抱歉,我的英语:)答案 0 :(得分:0)
我解决了我的问题,在设置cookie之前无法发送标题。
我使用了ob_start()并解决了我的问题