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

How to set timeout for flash messages in Flash/Session

I am using Phalcon/Flash/Session for flashing the notices or errors. I want them to disappear after some time. How to do that?



85.5k
$("document").ready(function(){
    setTimeout(function(){
        $("div.alert").remove();
    }, 5000 ); // 5 secs

});

Not through js.....cant we set the session timeout in the function itself...like $this->session->delete



85.5k

php outputs an html, after the html is send to the browser you see a "web page". After that the backend(php) cant control what your browser already have.

you can try using php sockets if you like https://socketo.me/docs/ but there is still some js ...