Codeigniter会话不起作用? [英] Codeigniter session doesn't work?

查看:52
本文介绍了Codeigniter会话不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于Codeigniter的网站,效果很好.我不得不将此站点与数据库克隆到另一台主机.我复制了数据库和所有文件.我的问题是:该会话在新站点上不起作用.(我在登录时识别了它).相同的代码可在旧主机上运行,​​但一切都完全相同.有人有什么主意吗?这是一个Codeigniter配置问题吗?谢谢

I have a website based on Codeigniter which works fine. I had to clone this site with database to an another host. I copied the database and all files. My problem is: the session doesn't work on the new site. (I recognized it at the login). The same code works on the old host, but everything is exactly the same. Does somebody have any idea? Is it a codeigniter configuration issue? Thanks

推荐答案

检查您的 application/config.php 尤其是这些行:

Check your application/config.php especially these lines:

$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']  = "/";
$config['cookie_secure']    = FALSE;

也:请删除您的cookie历史记录(如果您使用的是Firefox:CTRL-SHIFT-DELETE)

Also: please delete your cookie-history (if you're using Firefox: CTRL-SHIFT-DELETE)

或者,您可以使用(无耻的自我插入) codeigniter-native-session 内置的会话引擎也有很多问题.它基本上模仿了Codeigniter会话类,因此只需将这些文件放入应用程序文件夹中,代码就不需要任何修改.(并且您将使用PHP本机会话)

Alternatively you could use (shameless self-plug) codeigniter-native-session I too had a bit to much problems with the built-in session engine. It basically mimics the Codeigniter session class so just drop in these files into your application folder and code doesn't needs any modification. (and you'll be using PHP-native-sessions)

希望有帮助.

这篇关于Codeigniter会话不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆