Kohana框架3.3 cookie设置两次
16lz
2021-01-22
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变量上设置一个值。
更多相关文章
- 什么是从我的PHP网站过滤无效的utf8?
- 《细说PHP》第一章 LAMP网站的构建---读书笔记
- 网站优化之PHPCMS如何开启伪静态
- (phpQuery)对网站产品信息采集代码的优化
- mysql主从同步报slave_sql_running:no的解决方案
- 保存在Java桌面应用程序应用程序和网站上使用的个人用户设置的最
- win7下Django的MySql安装,问题解决方案
- mysql 事物没提交导致事物一直运行解决方案
- 无法连接远程MySQL数据库的解决方案