We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

flashSession is not working in Microframewok

Hi. flashSession is not working in Microframewok? Nothing displays...

services.php

    $di->setShared('flashSession', function(){
        return new \Phalcon\Flash\Session(array(
            'error' => 'alert alert-danger',
            'success' => 'alert alert-success',
            'notice' => 'alert alert-info',
            'warning' => 'alert alert-warning',
        ));
    });

index.php

        $app = new Phalcon\Mvc\Micro($di);

        $app->get('/', function () use ($app, $config) {
            $app->flashSession->error('Заполните форму');
            $app->flashSession->output();
            exit;
        });


14.3k

I tried this:

index.php

        $app = new Phalcon\Mvc\Micro($di);

        $app->get('/', function () use ($app, $config) {
            $app->flashSession->error('Заполните форму');
            echo $app['view']->render('index');
        });

index.phtml

<?=$this->flashSession->output();?>

it also does not work



85.5k
Accepted
answer

i think you needed to register session service also ( i am probably wrong but you can give it a try ).



14.3k

I have not activated the service session.. It worked