I'm using Kohana 3.3 and I'm trying to set a single unique cookie for every new site visitor. I'm doing it like this:
我正在使用Kohana 3.3,我正在尝试为每个新网站访问者设置一个唯一的cookie。我是这样做的:
if (!Cookie::get('unique_id'))
{
Cookie::set('unique_id', uniqid(), 9990000);
}
But when I visit my site with 'www.' in front of the domain it creates a second cookie with the same name, but different value. How can I fix this?
但是当我用“www”访问我的网站时在域前面,它创建了一个具有相同名称但价值不同的第二个cookie。我怎样才能解决这个问题?
1 个解决方案
#1
1
Found a solution. I had to edit the system/classes/Kohana/cookie.php file, and set a value on the $domain variable.
找到了解决方案。我必须编辑system / classes / Kohana / cookie.php文件,并在$ domain变量上设置一个值。
#1
1
Found a solution. I had to edit the system/classes/Kohana/cookie.php file, and set a value on the $domain variable.
找到了解决方案。我必须编辑system / classes / Kohana / cookie.php文件,并在$ domain变量上设置一个值。