【发布时间】:2010-10-27 16:02:08
【问题描述】:
所以我基本上无法在我的 Kohana 3 项目中使用任何类型的会话。问题的几个例子:
$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,在会话中,在重定向之前有一个正值,在它的值为 0 之后。我还尝试了基本的 PHP 会话——它可能在 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 在重定向之后为空。
不确定现在要尝试什么,我确实确保在 php.ini 中启用了 Sessions(我有很多其他应用程序,在其他框架或 CMS 下,当前已安装,我确信至少有一个他们使用会话)。目前我正在调查这个:http://forum.kohanaframework.org/discussion/3018/using-native-session-array/p1,虽然我怀疑这是这里的问题。
【问题讨论】:
标签: php session kohana kohana-3