PHP code example of instantech / session
1. Go to this page and download the library: Download instantech/session library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
instantech / session example snippets
tantech\Session;
session_start();
//Set value in the session with key test
Session::set("test", 'value');
//Get value matched key test
Session::get('test');
//Set a flash message with key success and value IT's success
Session::addFlash('success', "IT's succes");
//Read the flash message with key success
echo Session::flash('success');
//Clear all information in the session
Session::clear();
//Get an array of all value in the session
Session::all();
//Check if some key test exist in the session
Session::has('test');
//Check if some key success exist in the flash message
Session::hasFlash('success');
//Remove the value from the session with key test
Session::remove('test');