简体   繁体   中英

PHP Session in Kohana 3

So I'm basically unable to use any kind of session in my Kohana 3 project. A few example of the issue :

$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, in the session, has a positive value before the redirect, after it has a value of 0. I also tried with the basic PHP session - which may be disabled in Kohana - I don't know. Didn't thought so, since we can still use $_GET and $_POST.

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

Same scenario as before, except that now the $customer_id, after the redirect, is null.

Not sure what to try right now, I did make sure Sessions were enable in php.ini (I have quite a bunch of others application, under other framework or CMS, currently installed, and I'm convinced at least one of them use sessions). Currently I'm looking into this : http://forum.kohanaframework.org/discussion/3018/using-native-session-array/p1 , though I doubt it's the issue here.

Not sure what I was thinking when I was testing this - but I resolved this. I'd have to guess the issue here was my own profound stupidity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM