Welcome Guest, Not a member yet? Register   Sign In
Send success message to user after logout
#1

PHP Code:
public function logout()
    {
        session()->set('user');
        session()->destroy();
        session()->setFlashdata('success''logout successful!');
        return redirect('/');
    

Goal: when the user logs out, the application displays the message "logout successful." Problem: How can the flash message be displayed while the session has already been destroyed?
Reply
#2

see https://github.com/codeigniter4/shield/b...p#L96-L108
Reply
#3

Do not destroy the session. If you destroy it, you cannot use any feature of Session.

See https://github.com/codeigniter4/shield/b...#L817-L847
Reply
#4

@kenjis, @datamweb Thank you, I forgot there is a shield

Codeigniter Shield
Reply




Theme © iAndrew 2016 - Forum software by © MyBB