Question

I'm using version 1.5.0 of the Slim PHP framework, and I'm having problems with sessions. I've had no problems in the past (using Slim), so it leads me to believe it's either something changing with Slim, or something with my setup. Here is a basic snippet of routes in my index.php page.

$app->get('/test', function() use($app) {
    $_SESSION['test'] = 'blah';
    var_dump($_SESSION);
});

$app->get('/test2', function() use ($app) {
    var_dump($_SESSION);
});

The '/test' route outputs:

array(1) { ["test"]=> string(4) "blah" }

The '/test2' route outputs:

array(0) { }

What is up with my sessions. Am I doing something wrong? Should I be using something else than PHP's native sessions? I've even tried initializing Slim with the following property:

$app = new Slim(array(
    'session.handler' => null
));

Both options, to no avail.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top