Kohana 3 中的 PHP session

标签 php session kohana kohana-3

所以我基本上无法在我的 Kohana 3 项目中使用任何类型的 session 。该问题的一些示例:

$session = Session::instance();
$session->set('customer_id', $customer->id);
$this->request->redirect('controller/action');
//At the start of the redirected action
$session = Session::instance();
$customer_id = $session->get('customer_id');

$customer_id,在 session 中,在重定向之前具有正值,在其值为 0 之后。我也尝试过基本的 PHP session - 这可能在 Kohana 中被禁用 - 我不知道。没想到,因为我们仍然可以使用 $_GET 和 $_POST。

session_start();
$_SESSION['customer_id'] = $customer->id;
//At the start of the redirected action
session_start();
$customer_id = $_SESSION['customer_id'];

与之前的场景相同,只是现在重定向后的 $customer_id 为 null。

不知道现在要尝试什么,我确实确保在 php.ini 中启用了 session (我在其他框架或 CMS 下目前安装了很多其他应用程序,并且我确信至少有一个他们使用 session )。目前我正在研究这个:http://forum.kohanaframework.org/discussion/3018/using-native-session-array/p1 ,尽管我怀疑这是这里的问题。

最佳答案

不确定我在测试时在想什么 - 但我解决了这个问题。我不得不猜测这里的问题是我自己的愚蠢。

关于Kohana 3 中的 PHP session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4035209/

相关文章:

c# - 为什么在终结器中调用 Dispose() 会导致 ObjectDisposedException?

php - session_regenerate_id() 与 session_id(randomString)

php - session 上传进度

php - 使用 ORM kohana 限制结果

php - 更新用户详细信息,sql server 2008 sqlsrv

php - 在 SimpleXML 中美化/格式化输出

php - 在登录期间在配置中设置动态数据库 - Laravel

php - 图片加载失败,net::ERR_CONTENT_LENGTH_MISMATCH

Python Flask : keeping track of user sessions? 如何获取 Session Cookie ID?

php - 我无法连接到数据库