PHP code example of delboy1978uk / session

1. Go to this page and download the library: Download delboy1978uk/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/ */

    

delboy1978uk / session example snippets


use Del\SessionManager;

// Starting the session - also takes a name argument
SessionManager::sessionStart();

// Setting a variable
SessionManager::set('name', 'DelBoy');

// Check a session variable exists
$hasName = SessionManger::has('name');

// Getting a variable
$name = SessionManger::get('name');

// Unsetting a variable
SessionManager::destroy('name');

// Ending the session
SessionManager::destroySession();