Flash doesn't show after Response->redirect

I am setting the flash and then redirecting and no message is showing up. Here is the code: ```php $this->flash->success('Your comment is saved'); return $this->redirect('forum/show/'.$forumpostid); ``` And the redirect function is: ```php protected function redirect($uri){ $response = new \Phalcon\Http\Response(); return $response->redirect($uri); } ```

Am I doing something wrong?

Did you register session in your application?

    $di->set('session', function(){
        $session = new Phalcon\Session\Adapter\Files();
        $session->start();
        return $session;
    });


5.3k

Sorry that I didn't mention it - I am using a modified INVO app and the code for registering the session is exactly as yours. By the way if I use $this->dispatcher->forward the message is showing.



82.2k

Are you using Phalcon\Flash\Session instead of Phalcon\Flash\Direct?



5.3k

I am using Phalcon\Flash\Direct: ```php $di->set('flash', function(){ return new Phalcon\Flash\Direct(array( 'error' => 'alert alert-error', 'success' => 'alert alert-success', 'notice' => 'alert alert-info', )); }); ``` If I start using Phalcon\Flash\Session this should solve my problem - thanks!