Zebra_Session::set_flashdata PHP Méthode

set_flashdata() public méthode

Typically used for informational or status messages (for example: "data has been successfully updated"). first, connect to a database containing the sessions table include the library require 'path/to/Zebra_Session.php'; start the session where $link is a connection link returned by mysqli_connect $session = new Zebra_Session($link, 'sEcUr1tY_c0dE'); set "myvar" which will only be available for the next server request and will be automatically deleted afterwards $session->set_flashdata('myvar', 'myval'); Flashdata session variables can be retrieved as any other session variable: if (isset($_SESSION['myvar'])) { do something here but remember that the flashdata session variable is available for a single server request after it has been set! }
public set_flashdata ( string $name, string $value ) : void
$name string The name of the session variable. @param string $value The value of the session variable. @return void
$value string
Résultat void
    public function set_flashdata($name, $value)
    {
        // set session variable
        $_SESSION[$name] = $value;
        // initialize the counter for this flashdata
        $this->flashdata[$name] = 0;
    }