php - codeigniter flashdata not clearing -


i'm newbie codeigniter , i'm creating project in users created , managed. here i'm using flashdata display temporary messages "user created",etc.,

my code set flash data is

       $this->session->set_flashdata('message', 'user created.');  

in view called

$this->session->flashdata('message');  

my problem when user created,flashdata displayed , when click home link flash data still available when click refresh/home again disappears. want cleared when click home link first time itself. there way code it??.

flashdata available next server request, , automatically cleared.

if($user_created) {     $this->session->set_flashdata('success', 'user created!');     redirect('login'); } else {     redirect('register'); } 

Comments

  1. You need to use php version less than 7.4 or you can modify the following code to solve the problem-
    Root directory > system > libraries > Session > Session.php //Lines 418 to 423:

    // Hacky, but 'old' will (implicitly) always be less than time() ;)
    // DO NOT move this above the 'new' check!
    elseif ($value === 'old' || $value < $current_time)
    {
    unset($_SESSION[$key], $_SESSION['__ci_vars'][$key]);
    }

    ReplyDelete

Post a Comment

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -