Flash Data. $_SESSION in PHP

Asked

Viewed 269 times

0

Hi. I was wondering if there is any way to declare a variable $_SESSION only for the next request, then it is automatically deleted, as in the method$this->session->set_flashdata('msg', 'Bem-vindo') Codeigniter framework, but using only PHP?

  • No, you need to implement this feature. But what’s the point? Maybe there’s an alternative

  • I find this method of Codeigniter very useful (at least for me), but I’m still learning PHP, and I don’t feel good using a framework (I feel like an idiot), I want to start learning, first the language and not the framework (whatever). So I was wondering if there was a way to implement this functionality using PHP only, but thanks anyway :-)

1 answer

0

to monitor the next request itself I don’t know for sure, but let’s say that you created your session and at some point that can control in the code, for example something goes by get you can do it:

if(isset($_GET['req'])){
      unset($_SESSION['tuasessão']);

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.